Skip to content

Commit

Permalink
Merge pull request #13 from BJS-kr/fix/test_ms
Browse files Browse the repository at this point in the history
fix test waiting time
  • Loading branch information
BJS-kr authored Apr 19, 2024
2 parents cc4b2c7 + c377554 commit 55889e8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lib/test/in-memory.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe("e2e-in-memory", () => {
const result = await service.cacheableTaskWithArrayParam(array);
const diff = Date.now() - start;

biggerThan(diff, 1000);
biggerThan(diff, 900);
equal(result, array.join(""));

const start2 = Date.now();
Expand All @@ -280,7 +280,7 @@ describe("e2e-in-memory", () => {
const result3 = await service.cacheableTaskWithArrayParam(modifiedArray);
const diff3 = Date.now() - start3;

biggerThan(diff3, 1000);
biggerThan(diff3, 900);
equal(result3, modifiedArray.join(""));
});

Expand Down
46 changes: 23 additions & 23 deletions lib/test/service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from "@nestjs/common";
import { sleep } from "./util";
import {InMemCache, RedisCache, AnotherRedisCache} from "./cache.decorator";
import { InMemCache, RedisCache, AnotherRedisCache } from "./cache.decorator";

@Injectable()
export class InMemTestService {
Expand Down Expand Up @@ -71,28 +71,28 @@ export class RedisTestService {

@Injectable()
export class AnotherRedisTestService {
@AnotherRedisCache({
key: "cacheableTask1",
kind: "temporal",
ttl: 300,
})
async cacheableTask1() {
await sleep(1000);
return true;
}
@AnotherRedisCache({
key: "cacheableTask1",
kind: "temporal",
ttl: 300,
})
async cacheableTask1() {
await sleep(1000);
return true;
}

async cacheableTask2() {
await sleep(1000);
return true;
}
async cacheableTask2() {
await sleep(1000);
return true;
}

@AnotherRedisCache({
key: "cacheableTask3",
kind: "temporal",
ttl: 300,
})
async notCacheableTask() {
await sleep(1000);
return true;
}
@AnotherRedisCache({
key: "cacheableTask3",
kind: "temporal",
ttl: 300,
})
async notCacheableTask() {
await sleep(1000);
return true;
}
}

0 comments on commit 55889e8

Please sign in to comment.