Skip to content
Source
Sign inSign up
fuko/trytanstackdb-v2

Phase 4: Interactivity #7

Mergedfukomerged 16 commits intomain fromphase-4-interactivitymerged by fuko

Showing 62 changed files with 53 additions and 7 deletions (loading 58).

x
0 of 62 viewed, 62 left
2 additions and 2 deletionssrc/api/dev-console.tsModified
View file
@@ -4,8 +4,8 @@
import { clearRequestLog, requestLogStore } from "./request-log";
​
/**
- * Dev only: the fake API's knobs on `window.__fakeApi`, until phase 4 puts
- * them in the browser toolbar.
+ * Dev only: the fake API's knobs on `window.__fakeApi`, for scripts and
+ * debugging (readers use the browser toolbar's controls).
*
* __fakeApi.setNetworkConfig({ latencyMs: 2000 })
* __fakeApi.setNetworkConfig({ failNextRequest: true })
35 additions and 0 deletionssrc/api/fake-api.test.tsModified
View file
@@ -181,6 +181,31 @@
expect((await api.get<{ name: string }>("/api/folders/work")).name).toBe("Work");
});
​
+ it("fails the next request sent, not one already in flight", async () => {
+ vi.useFakeTimers();
+ setNetworkConfig({ latencyMs: 5000 });
+ const inFlight = fakeFetch("/api/folders/work", { method: "PATCH", ...json({ name: "Job" }) });
+ await vi.advanceTimersByTimeAsync(1000);