Public: anyone can read this; the crew can change it.
Full suite red: test/snapshot.test.ts #17703
Merged 12h 14m ago, live in production
scout/forge:scout/17701-full-suite-red-test-snapshot-test-ts → main 0 commits fork
1 file
changed +34
−11
test/snapshot.test.ts +34 −11
| @@ -354,23 +354,36 @@ describe("a forge back from a snapshot", () => { | ||
| 354 | 354 | ); |
| 355 | 355 | }); |
| 356 | 356 | |
| 357 | test("the backups page: nowhere to put them says so; with a store, the list and the button", async () => { | |
| 357 | /** Alice's session cookie: one password hash for the whole block, not one a test. */ | |
| 358 | let aliceCookie: Promise<string> | undefined; | |
| 359 | const signIn = (servers: Servers): Promise<string> => | |
| 360 | (aliceCookie ??= fetch(`${servers.url}/signin`, { | |
| 361 | method: "POST", | |
| 362 | headers: { origin: servers.url }, | |
| 363 | body: new URLSearchParams({ | |
| 364 | username: "alice", | |
| 365 | password: "a-good-passphrase", | |
| 366 | }), | |
| 367 | redirect: "manual", | |
| 368 | }).then((r) => (r.headers.get("set-cookie") ?? "").split(";")[0]!)); | |
| 369 | ||
| 370 | test("the backups page: nowhere to put them says so", async () => { | |
| 358 | 371 | const servers: Servers = await serve(app); |
| 359 | 372 | try { |
| 360 | const signedIn = await fetch(`${servers.url}/signin`, { | |
| 361 | method: "POST", | |
| 362 | headers: { origin: servers.url }, | |
| 363 | body: new URLSearchParams({ | |
| 364 | username: "alice", | |
| 365 | password: "a-good-passphrase", | |
| 366 | }), | |
| 367 | redirect: "manual", | |
| 368 | }); | |
| 369 | const cookie = (signedIn.headers.get("set-cookie") ?? "").split(";")[0]!; | |
| 373 | const cookie = await signIn(servers); | |
| 370 | 374 | const none = await ( |
| 371 | 375 | await fetch(`${servers.url}/settings/backups`, { headers: { cookie } }) |
| 372 | 376 | ).text(); |
| 373 | 377 | expect(none).toContain("No snapshots are taken"); |
| 378 | } finally { | |
| 379 | servers.stop(); | |
| 380 | } | |
| 381 | }); | |
| 382 | ||
| 383 | test("the backups page: with a store, the list and the button", async () => { | |
| 384 | const servers: Servers = await serve(app); | |
| 385 | try { | |
| 386 | const cookie = await signIn(servers); | |
| 374 | 387 | const { store } = await snapshotted(); |
| 375 | 388 | const svc = startSnapshots(app, store, { |
| 376 | 389 | version: "t", |
| @@ -405,6 +418,16 @@ describe("a forge back from a snapshot", () => { | ||
| 405 | 418 | } finally { |
| 406 | 419 | await svc.stop(); |
| 407 | 420 | } |
| 421 | } finally { | |
| 422 | servers.stop(); | |
| 423 | } | |
| 424 | }); | |
| 425 | ||
| 426 | test("the backups page: with a passphrase it names the variable; a stranger sees nothing", async () => { | |
| 427 | const servers: Servers = await serve(app); | |
| 428 | try { | |
| 429 | const cookie = await signIn(servers); | |
| 430 | const { store } = await snapshotted(); | |
| 408 | 431 | const wrapping = startSnapshots(app, store, { |
| 409 | 432 | version: "t", |
| 410 | 433 | nightly: false, |
new above
offline