Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: A more readable e2e caching test #94

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading