Skip to content

Commit

Permalink
fix: A more readable e2e caching test (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeesha authored Jan 25, 2024
1 parent 2f23464 commit ceef93f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ts-core/src/tests/caching/caching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe("Caching", () => {

const productId = Math.random().toString();

const result1 = await client.getProductLongCache(productId, {
const result1 = await client.getProductLongCache(productId, "foo", {
$cacheKey: productId,
});

const result2 = await client.getProductLongCache(productId, {
const result2 = await client.getProductLongCache(productId, "bar", {
$cacheKey: productId,
});

Expand All @@ -31,13 +31,13 @@ describe("Caching", () => {

const productId = Math.random().toString();

const result1 = await client.getProductShortCache(productId, {
const result1 = await client.getProductShortCache(productId, "foo", {
$cacheKey: productId,
});

await new Promise((resolve) => setTimeout(resolve, 1000)); // wait for cache to expire

const result2 = await client.getProductShortCache(productId, {
const result2 = await client.getProductShortCache(productId, "bar", {
$cacheKey: productId,
});

Expand Down
4 changes: 2 additions & 2 deletions ts-core/src/tests/caching/product.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { cached } from "../../functions";
import { d } from "./d";

export const getProduct = async (id: string) => {
export const getProduct = async (id: string, random: string) => {
return {
id,
name: `Product ${id}`,
retrievedAt: Date.now(),
random,
};
};

Expand Down

0 comments on commit ceef93f

Please sign in to comment.