Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
fix: unit test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrantsberg committed Feb 4, 2020
1 parent 7dea2b0 commit 0ae2341
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 304 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage
test/coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand All @@ -54,4 +55,4 @@ bower_components
dist

#vscode development
devindex.js
devindex.js
13 changes: 11 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
export { Cache, CacheClear, RedisStorage, LabShareCache, MemoryStorage,
ServicesCache, CacheBindings, CacheRequest, CacheStrategyResolverProvider} from './dist';
export {
Cache,
CacheClear,
RedisStorage,
LabShareCache,
MemoryStorage,
ServicesCache,
CacheBindings,
CacheRequest,
CacheStrategyResolverProvider,
} from './dist';
7 changes: 5 additions & 2 deletions lib/cache/storages/redis.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ export class RedisStorage implements IStorage {
}
}

public async getItem<T>(key: string | undefined): Promise<T> {
public async getItem<T>(key: string | undefined): Promise<T> | undefined {
const entry: any = await this.client.getAsync(key);
return JSON.parse(entry);
if (_.isString(entry)) {
return JSON.parse(entry);
}
return entry;
}

public async setItem(key: string, content: any): Promise<void> {
Expand Down
131 changes: 43 additions & 88 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 24 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
"url": "https://github.com/LabShare/services-cache/issues"
},
"license": "MIT",
"scripts": {
"build": "lb-tsc",
"test": "nyc --report-dir=./coverage mocha 'dist/test/**/*.js'",
"prepublish": "tsc -p .",
"prepare": "tsc -p .",
"dev": "tsc -p . -w",
"lint": "npm run prettier:check && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "lb-prettier \"**/*.ts\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"coverage:ci": "node packages/build/bin/run-nyc report --reporter=text-lcov | coveralls",
"coverage": "nyc npm run test",
"semantic-release": "semantic-release"
},
"dependencies": {
"@loopback/authentication": "^2.0.3",
"@loopback/context": "1.16.0",
Expand All @@ -35,56 +52,40 @@
"redis": "^2.8.0"
},
"devDependencies": {
"@loopback/build": "^3.1.0",
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.1",
"@labshare/semantic-release-config": "^1.0.0",
"@loopback/build": "^3.1.0",
"@loopback/eslint-config": "^5.0.2",
"@types/bluebird": "^3.5.24",
"@types/chai": "^4.1.7",
"@types/jest": "^24.0.13",
"@types/mocha": "^5.2.7",
"@types/node": "^10.11.2",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^5.0.5",
"@loopback/eslint-config": "^5.0.2",
"@typescript-eslint/eslint-plugin": "^2.19.0",
"@typescript-eslint/parser": "^2.19.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-eslint-plugin": "^2.2.1",
"eslint-plugin-mocha": "^6.2.2",
"body-parser": "1.18.3",
"chai": "^4.2.0",
"coveralls": "^3.0.1",
"delay": "3.0.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-eslint-plugin": "^2.2.1",
"eslint-plugin-mocha": "^6.2.2",
"husky": "^2.1.0",
"istanbul": "0.4.5",
"jasmine": "3.1.0",
"lerna": "^3.14.1",
"mocha": "^7.0.1",
"proxyquire": "^2.1.0",
"semantic-release": "^15.5.0",
"sinon": "^7.2.2",
"supertest": "3.1.0",
"ts-node": "^7.0.1",
"typescript": "^3.3.1"
},
"scripts": {
"build": "lb-tsc",
"test": "nyc --report-dir=./coverage mocha 'dist/test/**/*.js'",
"prepublish": "tsc -p .",
"prepare": "tsc -p .",
"dev": "tsc -p . -w",
"lint": "npm run prettier:check && && npm run eslint",
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
"prettier:cli": "lb-prettier \"lib/cache/**/*.ts\" \"lib/cache/**/*.js\" \"lib/cache/*.js\"",
"prettier:check": "npm run prettier:cli -- -l",
"prettier:fix": "npm run prettier:cli -- --write",
"eslint": "lb-eslint --report-unused-disable-directives .",
"eslint:fix": "npm run eslint -- --fix",
"coverage:ci": "node packages/build/bin/run-nyc report --reporter=text-lcov | coveralls",
"coverage": "nyc npm run test",
"semantic-release": "semantic-release"
},
"nyc": {
"reporter": [
"text",
Expand Down
Loading

0 comments on commit 0ae2341

Please sign in to comment.