client-front.test.ts
This file
Path
apps/web/test/client-front.test.ts
55 lines · 1.9 KiB · TypeScript
Last changed by
Merge build/comments-web-rest into mainoscabrielbefore adoption0eb1248
History of this fileTake it
Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 1–35why, one step back1import { describe, expect, it } from "@effect/vitest";2import { Effect, Exit } from "effect";34import { keys } from "../src/client/keys.ts";5import { ContractsClient } from "../src/surfaces.ts";6import { registryAs, seededWorld, settled } from "./dev-browser.ts";78describe("the front page, through the web's atoms", seededWorld, () => {9 it.live(10 "lists every open ask of both projects on the front page, the newcomers' one untakeable",11 () =>12 Effect.gen(function* () {13 const registry = registryAs();1415 const page = yield* settled(16 registry,17 ContractsClient.query(18 "frontPage",19 {},20 { reactivityKeys: keys.front() }21 )22 );2324 expect(Exit.isSuccess(page)).toBeTruthy();2526 const entries = Exit.isSuccess(page) ? page.value.entries : [];2728 expect(29 entries30 .map(31 ({ ask, project, takeable }) =>32 `${project}/${ask.ask} ${takeable}`33 )34 .toSorted()35 ).toStrictEqual([Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
lines 36–45why, one step back36 "oscabriel/burrow/drop-legacy-fetch false",37 "oscabriel/burrow/drop-legacy-fetch-burrow-auth true",38 "oscabriel/burrow/drop-legacy-fetch-burrow-billing true",39 "oscabriel/burrow/drop-legacy-fetch-burrow-catalog true",40 "oscabriel/burrow/drop-legacy-fetch-burrow-kit true",41 "oscabriel/burrow/drop-legacy-fetch-burrow-notify true",42 "oscabriel/burrow/drop-legacy-fetch-burrow-search true",43 "oscabriel/datekit/add-months-clamp true",44 "oscabriel/datekit/format-ordinal false",45 "oscabriel/datekit/parse-iso-week false",Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215
lines 46–55why, one step back46 ]);4748 const reserved = entries.find(({ ask }) => ask.reserve !== undefined);4950 expect(reserved?.ask.ask).toBe("format-ordinal");51 expect(reserved?.ask.reserve).toBe("newcomers");52 expect(reserved?.ask.claimed).toBeFalsy();53 })54 );55});