Skip to content

Commit

Permalink
fix(lru-redis): ensure tests are valid
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Mar 9, 2020
1 parent 12356d8 commit fe1a9f9
Show file tree
Hide file tree
Showing 4 changed files with 246 additions and 4 deletions.
230 changes: 230 additions & 0 deletions storages/lru-redis/package-lock.json

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

3 changes: 2 additions & 1 deletion storages/lru-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
"lru-cache": "^5.1.1"
},
"devDependencies": {
"ioredis-mock": "^4.19.0",
"@types/ioredis": "^4.14.8",
"@types/lru-cache": "^5.1.0"
},
"gitHead": "179ca6def52cbf51e09fc22c09f7313d6356105b"
"gitHead": "12356d80b38a7b841fa377840f13c37fbe3c9cd3"
}
2 changes: 1 addition & 1 deletion storages/lru-redis/src/LRUWithRedisStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class LRUWithRedisStorage implements StorageTypes {
}
}

return localCache;
return localCache || undefined;
}

public async setItem(key: string, content: any): Promise<void> {
Expand Down
15 changes: 13 additions & 2 deletions storages/lru-redis/test/lru.storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import * as Assert from "assert";
import LRUStorage from "../src";
import LRURedisStorage from "../src";

const storage = new LRUStorage({});

// @ts-ignore
import * as RedisMock from "ioredis-mock";

const MockedRedis = new RedisMock({
host: "host",
port: 123,
password: "pass"
});


const storage = new LRURedisStorage({}, () => MockedRedis);

describe("LRUStorage", () => {
it("Should add cache item correctly", async () => {
Expand Down

0 comments on commit fe1a9f9

Please sign in to comment.