answer.test.tsx
This file
Path
apps/web/test/answer.test.tsx
740 lines · 23.9 KiB · TypeScript
Last changed by
Merge redesign into mainoscabrielbefore adoptioncaedd21
History of this fileTake it
1import { describe, expect, it } from "@effect/vitest";2import { Brand } from "@repo/brand";3import { Client, Contracts } from "@repo/protocol/contracts";4import type { Verdict } from "@repo/protocol/domain/answer";5import type { Ask } from "@repo/protocol/domain/ask";6import { Outcome } from "@repo/protocol/domain/outcome";7import type { StageName } from "@repo/protocol/domain/outcome";8import { AreaName, AskId, CommitSha, DecisionId } from "@repo/protocol/ids";9import {10 ChecksFailed,11 HeldBackFailed,12 UnknownAsk,13 UnknownCommit,14} from "@repo/protocol/refusal";15import { explain } from "@repo/protocol/render";16import { asTester, unanswered } from "@repo/protocol/testing";17import { isNotFound } from "@tanstack/react-router";18import { Effect, Layer, Ref, Schema, Stream } from "effect";19import { RpcTest } from "effect/rpc";2021import {22 AnswerView,23 durationText,24 HeldBackBits,25} from "../src/features/answer/answer-page.tsx";26import { readAnswer } from "../src/features/answer/reads.ts";27import { askStates } from "../src/features/shared/ask-progress.ts";28import { Refusals } from "../src/features/shared/refusals.ts";29import {30 ask,31 askId,32 brief,33 claimedEvent,34 decidedLanding,35 family,36 inOrder,37 judgedEvent,38 landedSha,39 landing,40 markupOf,41 now,42 plainLanding,43 plainText,44 project,45 suite,46 textOf,47 verdictOf,48} from "./ask-fixtures.ts";49import { textIn } from "./markup.ts";50import { elementWith } from "./records.ts";5152const checksFailed = new ChecksFailed({53 lane: "unit",54 logRef: "logs/datekit/parse-iso-week/unit",55 next: `${Brand.cli} evidence logs/datekit/parse-iso-week/unit`,56});5758const heldBackFailed = new HeldBackFailed({ area: "export", suite });5960const refused = verdictOf(61 Outcome.cases.Refused.make({ refusals: [checksFailed, heldBackFailed] })62);6364const stagesOf = (markup: string) =>65 [...markup.matchAll(/<li\b[^>]*>/gu)].flatMap(([tag]) => {66 const stage = /data-stage="(?<value>[^"]+)"/u.exec(tag)?.groups?.value;67 const state = /data-state="(?<value>[^"]+)"/u.exec(tag)?.groups?.value;6869 return stage === undefined || state === undefined ? [] : [[stage, state]];70 });7172const lanesOf = (markup: string) =>73 [...markup.matchAll(/<[a-z]+\b[^>]*data-lane="[^"]*"[^>]*>/gu)].flatMap(74 ([tag]) => {75 const lane = /data-lane="(?<value>[^"]+)"/u.exec(tag)?.groups?.value;76 const result = /data-result="(?<value>[^"]+)"/u.exec(tag)?.groups?.value;7778 return lane === undefined || result === undefined ? [] : [[lane, result]];79 }80 );8182const commitLinksOf = (markup: string) =>83 [84 ...markup.matchAll(85 /<a\b[^>]*href="(?<href>[^"]*\/commit\/[^"]*)"[^>]*>(?<inner>.*?)<\/a>/gu86 ),87 ].flatMap(({ groups }) =>88 groups?.href === undefined || groups.inner === undefined89 ? []90 : [[groups.href, plainText(groups.inner).trim()]]91 );9293const heroOf = (markup: string) =>94 /<section aria-label="Outcome"[^>]*>(?<inner>.*?)<\/section>/su.exec(markup)95 ?.groups?.inner ?? "";9697const runOf = (markup: string) =>98 markup.slice(markup.indexOf('id="answer-gate"'), markup.indexOf("</main>"));99100const mainOf = (markup: string) =>101 /<main\b[^>]*>(?<inner>.*)<\/main>/su.exec(markup)?.groups?.inner ?? "";102103const factsOf = (markup: string) => elementWith(markup, 'data-facts="inline"');104105const page = (106 props: Partial<Parameters<typeof AnswerView>[0]> & {107 readonly verdict: Verdict | undefined;108 }109) => <AnswerView ask={ask} now={now} {...props} />;110111const landedAt = (stage: StageName, heldBack: boolean) => ({112 ...verdictOf(Outcome.cases.Landed.make({ sha: landedSha })),113 heldBack: heldBack114 ? verdictOf(Outcome.cases.Landed.make({ sha: landedSha })).heldBack115 : [],116 stage,117});118119describe("the answer page", () => {120 const refusedPage = page({ verdict: refused });121122 it("titles the page with the ask's want, and names the project, the ask and the answer in its trail", () => {123 const markup = markupOf(refusedPage);124125 expect(markup).toMatch(126 /<h1\b[^>]*>Parse ISO week dates like 2026-W41-3<\/h1>/u127 );128 expect(129 inOrder(textOf(refusedPage), ["datekit", "Asks", askId, "Answer"])130 ).toBeTruthy();131 expect(markup).toContain('href="/oscabriel/datekit"');132 expect(markup).toContain(`href="/oscabriel/datekit/asks/${askId}"`);133 });134135 it("leads with the outcome: the first heading after the title is the hero, and a landing links its commit", () => {136 const landed = landedAt("human", true);137 const markup = markupOf(page({ landing: decidedLanding, verdict: landed }));138 const afterTitle = markup.slice(markup.indexOf("</h1>"));139140 const hero =141 /<section aria-label="Outcome"[^>]*>(?<inner>.*?)<\/section>/su.exec(142 afterTitle143 );144145 expect(hero).not.toBeNull();146 expect(afterTitle.indexOf('<section aria-label="Outcome"')).toBeLessThan(147 afterTitle.indexOf("<h2")148 );149 expect(plainText(hero?.groups?.inner ?? "")).toContain("Landed as 9b1c3e5");150 expect(hero?.groups?.inner).toContain(151 `href="/oscabriel/datekit/commit/${landedSha}"`152 );153 });154155 it("puts what was judged last in main, after the outcome and the gate, and only there", () => {156 const markup = markupOf(refusedPage);157 const main = mainOf(markup);158 const strip = main.indexOf('data-stage="human"');159160 expect(strip).toBeGreaterThan(main.indexOf('aria-label="Outcome"'));161 expect(main.lastIndexOf("Patch id")).toBeGreaterThan(strip);162 expect(main.lastIndexOf("Merged tree")).toBeGreaterThan(strip);163 expect(factsOf(markup)).not.toContain("Patch id");164 });165166 it("shows the stages the answer passed, the one that refused it, and the ones it never reached", () => {167 expect(stagesOf(mainOf(markupOf(refusedPage)))).toStrictEqual([168 ["parse", "passed"],169 ["shape", "passed"],170 ["merge", "passed"],171 ["cheap", "passed"],172 ["checks", "refused"],173 ["heldBack", "pending"],174 ["human", "pending"],175 ]);176 });177178 it("reads the maintainer and held-back stages as not needed for a landing that needed neither", () => {179 const markup = markupOf(180 page({ landing: plainLanding, verdict: landedAt("human", false) })181 );182183 expect(stagesOf(mainOf(markup)).slice(5)).toStrictEqual([184 ["heldBack", "skipped"],185 ["human", "skipped"],186 ]);187 expect(188 textOf(page({ landing: plainLanding, verdict: landedAt("human", false) }))189 ).toContain("not needed");190 });191192 it("reads them passed for a landing a maintainer finished and held-back checks judged", () => {193 const markup = markupOf(194 page({ landing: decidedLanding, verdict: landedAt("human", true) })195 );196197 expect(stagesOf(mainOf(markup)).slice(5)).toStrictEqual([198 ["heldBack", "passed"],199 ["human", "passed"],200 ]);201 });202203 it("opens failed lanes first, each with the command that reads its log, and folds the passed ones into a line", () => {204 const markup = markupOf(refusedPage);205 const text = textOf(refusedPage);206207 expect(lanesOf(mainOf(markup))).toStrictEqual([208 ["unit", "failed"],209 ["lint", "passed"],210 ]);211 expect(text).toContain(212 `${Brand.cli} evidence logs/datekit/parse-iso-week/unit --project oscabriel/datekit`213 );214 expect(text).toContain("1 lane passed in 1.2 s");215 expect(216 /<details\b[^>]*>.*data-lane="lint".*<\/details>/su.test(mainOf(markup))217 ).toBeTruthy();218 expect(inOrder(text, ["unit", "bun test", "failed", "8.3 s"])).toBeTruthy();219 });220221 it("keeps each passed lane's command and how long it ran inside the folded line", () => {222 const folded =223 /<details\b[^>]*>(?<inner>.*)<\/details>/su.exec(224 mainOf(markupOf(refusedPage))225 )?.groups?.inner ?? "";226227 expect(228 inOrder(plainText(folded), ["lint", "bun run lint", "passed", "1.2 s"])229 ).toBeTruthy();230 });231232 it("says no lane has run yet while the answer is checking, and that none ran once it was refused before them", () => {233 const checking = {234 ...verdictOf(Outcome.cases.Checking.make({ stage: "cheap" })),235 lanes: [],236 stage: "cheap" as const,237 };238239 const refusedEarly = { ...refused, lanes: [], stage: "shape" as const };240241 expect(textOf(page({ verdict: checking }))).toContain(242 "No lane has run yet."243 );244 expect(textOf(page({ verdict: checking }))).not.toContain("No lane ran");245 expect(textOf(page({ verdict: refusedEarly }))).toContain(246 "No lane ran on this answer."247 );248 });249250 it("names the ask and the round right under the title, before the outcome", () => {251 const states = askStates([252 claimedEvent(1, "okafor"),253 judgedEvent(2, refused.outcome),254 ]);255256 const markup = mainOf(markupOf(page({ states, verdict: refused })));257 const round = markup.indexOf("round 1 of 1");258259 expect(round).toBeGreaterThan(markup.indexOf("</h1>"));260 expect(round).toBeLessThan(markup.indexOf('aria-label="Outcome"'));261 });262263 it("gives no claim command for an ask that still waits on others to land", () => {264 const blocked = { ...ask, blockedBy: [AskId.make("split-format")] };265 const markup = mainOf(markupOf(page({ ask: blocked, verdict: undefined })));266267 expect(textIn(markup)).not.toContain(`${Brand.cli} claim`);268 expect(textIn(markup)).toContain("waits for 1 ask to land first");269 expect(markup).toContain(`href="/oscabriel/datekit/asks/${askId}"`);270 });271272 it("names a lane's log only as the command that reads it", () => {273 const passing = verdictOf(Outcome.cases.Checking.make({ stage: "checks" }));274 const text = textOf(page({ verdict: passing }));275276 const mentions = [277 ...text.matchAll(/logs\/datekit\/parse-iso-week\/unit/gu),278 ];279280 expect(mentions.length).toBeGreaterThan(0);281282 for (const { index } of mentions) {283 expect(text.slice(index - `${Brand.cli} evidence `.length, index)).toBe(284 `${Brand.cli} evidence `285 );286 }287 });288289 it("shows held-back checks only as an area's counts and its suite root, shortened, the whole root in its title", () => {290 const bits =291 /<ul aria-label="Held-back checks by area"[^>]*>(?<inner>.*?)<\/ul>/su.exec(292 markupOf(refusedPage)293 )?.groups?.inner;294295 expect(plainText(bits ?? "").trim()).toBe("export 6/7 @ sha256:4f2a4f…");296 expect(bits).toContain(`title="${suite}"`);297 });298299 it("reads an answer's rounds first in main, newest first, the one on the page selected, and leaves them out of its facts", () => {300 const states = askStates([301 claimedEvent(1, "okafor"),302 judgedEvent(2, refused.outcome, CommitSha.make("e".repeat(40))),303 judgedEvent(3, refused.outcome),304 ]);305306 const markup = markupOf(page({ states, verdict: refused }));307 const main = mainOf(markup);308 const rounds = main.slice(main.indexOf('id="answer-rounds"'));309310 expect(main.indexOf('id="answer-rounds"')).toBeGreaterThan(-1);311 expect(main.indexOf('id="answer-rounds"')).toBeLessThan(312 main.indexOf('id="answer-gate"')313 );314 expect(315 inOrder(textIn(rounds), ["Round 2 of 2", "Round 1 of 2"])316 ).toBeTruthy();317 expect(rounds).toMatch(/data-selected="true"[^>]*>[\s\S]*?Round 2 of 2/u);318 expect(textIn(factsOf(markup))).not.toContain("Rounds");319 });320321 it("draws no rounds region for an answer's only round", () => {322 const states = askStates([323 claimedEvent(1, "okafor"),324 judgedEvent(2, refused.outcome),325 ]);326327 expect(mainOf(markupOf(page({ states, verdict: refused })))).not.toContain(328 'id="answer-rounds"'329 );330 });331332 it("tells a waiting answer's contributor there is nothing to run, and what a push would start", () => {333 const waiting = verdictOf(334 Outcome.cases.AwaitingDecision.make({335 decision: DecisionId.make("dec-000001"),336 })337 );338339 const states = askStates([340 claimedEvent(1, "okafor"),341 judgedEvent(2, refused.outcome, CommitSha.make("e".repeat(40))),342 judgedEvent(3, waiting.outcome),343 ]);344345 expect(346 textIn(mainOf(markupOf(page({ states, verdict: waiting }))))347 ).toContain(348 "Nothing for you to run. Pushing again starts round 3; this verdict stays as round 2."349 );350 expect(textIn(mainOf(markupOf(refusedPage)))).not.toContain(351 "Nothing for you to run."352 );353 });354355 it("tells a landing as a sentence, then credits the people at title weight, then links the landing commit", () => {356 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));357 const markup = markupOf(page({ landing, verdict: landed }));358 const region = markup.slice(markup.indexOf('id="answer-landing"'));359360 expect(361 inOrder(textIn(region), [362 "Landed as 9b1c3e5",363 "asked by ines-v",364 "Credit",365 "Asked-by: ines-v",366 "The landing commit",367 ])368 ).toBeTruthy();369 expect(region).toMatch(/<h3 class="[^"]*text-title[^"]*">Credit<\/h3>/u);370 });371372 it("shows the refusals' explain lines in order, as git printed them", () => {373 expect(374 inOrder(375 textOf(refusedPage),376 explain([checksFailed, heldBackFailed]).map((line) => line.trim())377 )378 ).toBeTruthy();379 });380381 it("names the answer it judged, its round, and when", () => {382 const states = askStates([383 claimedEvent(1, "okafor"),384 judgedEvent(2, refused.outcome, CommitSha.make("e".repeat(40))),385 judgedEvent(3, refused.outcome),386 ]);387388 const element = page({ states, verdict: refused });389 const text = textOf(element);390391 for (const shown of [392 "round 2 of 2",393 "bbbbbbb",394 "aaaaaaa",395 "redThenGreen@0.0.0+5e1d",396 "20 min ago",397 "okafor's move",398 ]) {399 expect(text).toContain(shown);400 }401 });402403 it("reads a wait on a decision as waiting, in the hero", () => {404 const waiting = verdictOf(405 Outcome.cases.AwaitingDecision.make({406 decision: DecisionId.make("dec-000001"),407 })408 );409410 const text = textOf(page({ verdict: waiting }));411412 expect(text).toContain("Waiting on decision dec-000001");413 });414415 it("gives an ask nobody answered the command that claims it", () => {416 const text = textOf(page({ verdict: undefined }));417418 expect(text).toContain("Nobody has answered this ask yet.");419 expect(text).toContain(420 `${Brand.cli} claim ${askId} --project oscabriel/datekit`421 );422 expect(markupOf(page({ verdict: undefined }))).not.toContain("data-stage");423 });424425 it("names who holds a claimed ask with no answer pushed, and links back to the ask", () => {426 const states = askStates([claimedEvent(1, "bram")]);427 const element = page({ states, verdict: undefined });428 const main = mainOf(markupOf(element));429430 expect(textIn(main)).toContain("Claimed by bram, no answer pushed yet.");431 expect(main).toContain(`href="/oscabriel/datekit/asks/${askId}"`);432 });433434 it("shows a landed answer's credit trailers in trailer order, its held-back trailer, and its commit", () => {435 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));436 const text = textOf(page({ landing, verdict: landed }));437438 expect(text).toContain("Landed as 9b1c3e5");439 expect(440 inOrder(text, ["Asked-by: ines-v", "Signed-off-by: okafor"])441 ).toBeTruthy();442 expect(text).toContain(`Held-back: export 7/7 @ ${suite}`);443 expect(text).toContain("Assisted-by: claude-code:opus-5 (verified)");444 expect(text).toContain(`git show ${landedSha}`);445 });446447 it("links a landed answer's landing (from the hero and the landing) and its base to their commit pages", () => {448 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));449 const markup = markupOf(page({ landing, verdict: landed }));450451 expect(commitLinksOf(heroOf(markup))).toStrictEqual([452 [`/${project}/commit/${landedSha}`, "9b1c3e5"],453 ]);454 expect(commitLinksOf(runOf(markup))).toStrictEqual([455 [`/${project}/commit/${landed.base}`, landed.base.slice(0, 7)],456 [`/${project}/commit/${landedSha}`, "9b1c3e5"],457 [`/${project}/commit/${landedSha}`, "The landing commit"],458 ]);459 });460461 it("links neither the head nor the merged tree: they live in the claim's fork", () => {462 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));463 const markup = markupOf(page({ landing, verdict: landed }));464465 expect(markup).not.toContain(`/commit/${landed.head}`);466 expect(markup).not.toContain(`/commit/${landed.tree}`);467 });468469 it("links the base and no landing when the answer has not landed", () => {470 expect(commitLinksOf(heroOf(markupOf(refusedPage)))).toStrictEqual([]);471 expect(commitLinksOf(runOf(markupOf(refusedPage)))).toStrictEqual([472 [`/${project}/commit/${refused.base}`, refused.base.slice(0, 7)],473 ]);474 });475476 it("stamps the landed mark only when the page is told the landing came while it was open", () => {477 const landed = landedAt("human", false);478479 expect(480 markupOf(page({ landing: plainLanding, stamp: true, verdict: landed }))481 ).toContain("animate-stamp");482 expect(483 markupOf(page({ landing: plainLanding, verdict: landed }))484 ).not.toContain("animate-stamp");485 });486487 it("draws a family member's family, the member marked", () => {488 const child = family.child(1);489490 const markup = markupOf(491 <AnswerView492 ask={child}493 now={now}494 parent={family.parent}495 verdict={refused}496 />497 );498499 expect(factsOf(markup)).toContain(`data-family="${family.parent.id}"`);500 expect(factsOf(markup)).toMatch(501 /aria-current="true"[^>]*title="retire-old-week-parse"|title="retire-old-week-parse"[^>]*aria-current="true"/u502 );503 });504});505506describe(HeldBackBits, () => {507 it("shows one line per area, and nothing else about the held-back checks", () => {508 const results = [509 { area: AreaName.make("export"), passed: 6, suite, total: 7 },510 { area: AreaName.make("parse"), passed: 3, suite, total: 3 },511 ];512513 expect(textOf(<HeldBackBits results={results} />).trim()).toBe(514 "export 6/7 @ sha256:4f2a4f… parse 3/3 @ sha256:4f2a4f…"515 );516 });517});518519describe(durationText, () => {520 it("says how long a lane ran in the unit a person reads", () => {521 expect([640, 8312, 125_000].map(durationText)).toStrictEqual([522 "640 ms",523 "8.3 s",524 "2 min 5 s",525 ]);526 });527});528529interface Asked {530 readonly asks: number;531 readonly landings: number;532 readonly replays: number;533 readonly verdicts: number;534}535536const replay = [537 claimedEvent(1, "bram"),538 claimedEvent(2, "okafor", AskId.make("format-week")),539 judgedEvent(3, refused.outcome),540];541542const count = (asked: Ref.Ref<Asked>, key: keyof Asked) =>543 Ref.update(asked, (seen) => ({ ...seen, [key]: seen[key] + 1 }));544545const platformAt = (546 asked: Ref.Ref<Asked>,547 outcome: Outcome,548 landingKnown = true,549 shown: Ask = ask550) =>551 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(552 Layer.provide([553 Layer.mergeAll(554 unanswered,555 Contracts.toLayerHandler("verdict", (payload) =>556 Effect.gen(function* () {557 yield* count(asked, "verdicts");558559 if (payload.ask !== askId) {560 return yield* new UnknownAsk({ ask: payload.ask });561 }562563 return { verdict: verdictOf(outcome) };564 })565 ),566 Contracts.toLayerHandler("showAsk", (payload) =>567 Effect.gen(function* () {568 yield* count(asked, "asks");569570 if (payload.ask !== shown.id && payload.ask !== family.parent.id) {571 return yield* new UnknownAsk({ ask: payload.ask });572 }573574 return {575 ask: payload.ask === shown.id ? shown : family.parent,576 brief,577 };578 })579 ),580 Contracts.toLayerHandler("watch", () =>581 Stream.fromEffect(count(asked, "replays")).pipe(582 Stream.flatMap(() => Stream.fromIterable(replay))583 )584 ),585 Contracts.toLayerHandler("landing", (payload) =>586 Effect.gen(function* () {587 yield* count(asked, "landings");588589 if (!landingKnown || payload.sha !== landedSha) {590 return yield* new UnknownCommit({ sha: payload.sha });591 }592593 return { landing };594 })595 )596 ),597 asTester,598 ])599 );600601const nothingAsked: Asked = { asks: 0, landings: 0, replays: 0, verdicts: 0 };602603describe(readAnswer, () => {604 it.effect(605 "reads a landed answer's landing with its verdict, its ask and the ask's events",606 () =>607 Effect.gen(function* () {608 const asked = yield* Ref.make(nothingAsked);609 const landed = Outcome.cases.Landed.make({ sha: landedSha });610611 const read = yield* readAnswer({ ask: askId, project }).pipe(612 Effect.provide(platformAt(asked, landed))613 );614615 expect({616 events: read.events.map(({ seq }) => seq),617 landing: read.landing?.sha,618 lastSeq: read.lastSeq,619 outcome: read.verdict?.outcome._tag,620 parent: read.parent,621 want: read.askRead.brief.want,622 }).toStrictEqual({623 events: [1, 3],624 landing: landedSha,625 lastSeq: 3,626 outcome: "Landed",627 parent: undefined,628 want: ask.brief.want,629 });630 expect(yield* Ref.get(asked)).toStrictEqual({631 asks: 1,632 landings: 1,633 replays: 1,634 verdicts: 1,635 });636 })637 );638639 it.effect("reads a family member's parent, for the family", () =>640 Effect.gen(function* () {641 const asked = yield* Ref.make(nothingAsked);642643 const read = yield* readAnswer({ ask: askId, project }).pipe(644 Effect.provide(645 platformAt(asked, refused.outcome, true, {646 ...family.child(0),647 id: askId,648 })649 )650 );651652 expect(read.parent?.id).toBe(family.parent.id);653 expect(yield* Ref.get(asked)).toStrictEqual({654 asks: 2,655 landings: 0,656 replays: 1,657 verdicts: 1,658 });659 })660 );661662 it.effect("asks for no landing when the answer did not land", () =>663 Effect.gen(function* () {664 const asked = yield* Ref.make(nothingAsked);665666 const read = yield* readAnswer({ ask: askId, project }).pipe(667 Effect.provide(platformAt(asked, refused.outcome))668 );669670 expect(read.verdict?.outcome._tag).toBe("Refused");671 expect(read.landing).toBeUndefined();672 expect((yield* Ref.get(asked)).landings).toBe(0);673 })674 );675 it.effect(676 "shows the verdict alone when the platform no longer finds its landing",677 () =>678 Effect.gen(function* () {679 const asked = yield* Ref.make(nothingAsked);680 const landed = Outcome.cases.Landed.make({ sha: landedSha });681682 const read = yield* readAnswer({ ask: askId, project }).pipe(683 Effect.provide(platformAt(asked, landed, false))684 );685686 expect(read.verdict?.outcome._tag).toBe("Landed");687 expect(read.landing).toBeUndefined();688 })689 );690691 it.effect(692 "is a not-found carrying the UnknownAsk refusal for an ask the project lacks",693 () =>694 Effect.gen(function* () {695 const asked = yield* Ref.make(nothingAsked);696 const missing = AskId.make("no-such-ask");697698 const failed = yield* Effect.flip(699 readAnswer({ ask: missing, project }).pipe(700 Effect.provide(701 platformAt(702 asked,703 Outcome.cases.Checking.make({ stage: "checks" })704 )705 )706 )707 );708709 expect(isNotFound(failed)).toBeTruthy();710711 const carried = yield* Schema.decodeUnknownEffect(Refusals)(712 isNotFound(failed) ? failed.data : undefined713 );714715 expect(explain(carried)).toStrictEqual(716 explain([new UnknownAsk({ ask: missing })])717 );718 })719 );720721 it.effect(722 "is a not-found with no refusal, and asks nothing, when ?head= is not a whole commit id",723 () =>724 Effect.gen(function* () {725 const asked = yield* Ref.make(nothingAsked);726727 const failed = yield* Effect.flip(728 readAnswer({ ask: askId, head: "9b1c3e5", project }).pipe(729 Effect.provide(platformAt(asked, refused.outcome))730 )731 );732733 expect(isNotFound(failed)).toBeTruthy();734 expect(735 isNotFound(failed) ? failed.data : "not a not-found"736 ).toBeUndefined();737 expect(yield* Ref.get(asked)).toStrictEqual(nothingAsked);738 })739 );740});