Files
radicle-explorer/tests/unit/cache.test.ts
T
Rūdolfs OšiņšandSebastian Martinez 9cb9332e88 Replace Cypress with Playwright
Playwright is more flexible and has better developer experience than Cypress.
We add end to end tests covering:

  - project source browsing
    - tree view
    - commit list view
    - commit view
  - routing
    - hash based
    - history API based
  - clipboard copy paste functionality
  - seed view
  - project search
  - landing page view
  - settings

Co-authored-by: Sebastian Martinez <me@sebastinez.dev>
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2022-12-01 15:54:56 +01:00

14 lines
444 B
TypeScript

import { cached } from "@app/cache";
import { expect, test, vi } from "vitest";
test("it caches undefined return values", async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const inner = vi.fn(async (_: string) => undefined);
const memoized = cached(inner, key => key);
expect(await memoized("a")).toBe(undefined);
expect(await memoized("a")).toBe(undefined);
expect(inner).toHaveBeenCalledTimes(1);
});