diff --git a/pkgs/id/crates/id-web/src/routes.rs b/pkgs/id/crates/id-web/src/routes.rs index 0e83e85e5a..505d320828 100644 --- a/pkgs/id/crates/id-web/src/routes.rs +++ b/pkgs/id/crates/id-web/src/routes.rs @@ -2765,11 +2765,7 @@ mod upload_router_tests { // the invite through the mount-scoped API URL — the session // round-trip (refused anonymously, served with the secret) // behaves exactly as it does on the program surface itself. - let res = app - .clone() - .oneshot(invite(Some("s3cret"))) - .await - .unwrap(); + let res = app.clone().oneshot(invite(Some("s3cret"))).await.unwrap(); assert_eq!(res.status(), StatusCode::OK); let body = to_bytes(res.into_body(), usize::MAX).await.unwrap(); assert!(!body.is_empty()); @@ -2779,8 +2775,7 @@ mod upload_router_tests { async fn publication_mounts_isolate_sibling_worlds_at_the_router() { let (_, mut state, _dir, _endpoint, _docs) = router_with_state().await; let opener = id_worlds::world_hub::testing::MemoryOpener::new(false); - let dyn_opener: std::sync::Arc = - opener.clone(); + let dyn_opener: std::sync::Arc = opener.clone(); let hub = id_worlds::world_hub::WorldHub::new( dyn_opener, Some("admin".to_owned()), @@ -2831,7 +2826,11 @@ mod upload_router_tests { .oneshot(invite("/prog/api/world/invite", "vault")) .await .unwrap(); - assert_eq!(res.status(), StatusCode::NOT_FOUND, "invite vault via /prog"); + assert_eq!( + res.status(), + StatusCode::NOT_FOUND, + "invite vault via /prog" + ); let res = app .clone() .oneshot(invite("/vault/api/world/invite", "vault")) diff --git a/pkgs/id/hosted-worker/test/front-door.test.ts b/pkgs/id/hosted-worker/test/front-door.test.ts index bc3ad98dde..7909a7de56 100644 --- a/pkgs/id/hosted-worker/test/front-door.test.ts +++ b/pkgs/id/hosted-worker/test/front-door.test.ts @@ -85,24 +85,24 @@ function front(path: string, init: RequestInit = {}): Request { function countingBody(chunks: Uint8Array[]) { const seen = { bytes: 0 }; let i = 0; - const body = new ReadableStream({ - pull(c) { - if (i >= chunks.length) return c.close(); - const chunk = chunks[i++]; - seen.bytes += chunk.byteLength; - c.enqueue(chunk); + const body = new ReadableStream( + { + pull(c) { + if (i >= chunks.length) return c.close(); + const chunk = chunks[i++]; + seen.bytes += chunk.byteLength; + c.enqueue(chunk); + }, }, - }, { highWaterMark: 0 }); + { highWaterMark: 0 }, + ); return { body, seen }; } test("a declared oversized body is refused at the front door without being read", async () => { const { env, calls } = makeEnv({ USER_CEILING_BYTES: "10" }); const { body, seen } = countingBody([new Uint8Array(64)]); - const r = await worker.fetch( - front("/v1/blobs", { method: "PUT", body, headers: { "content-length": "64" } }), - env, - ); + const r = await worker.fetch(front("/v1/blobs", { method: "PUT", body, headers: { "content-length": "64" } }), env); assert.equal(r.status, 413); assert.equal(((await r.json()) as { error: string }).error, "body_too_large"); assert.equal(seen.bytes, 0, "the body was never read"); diff --git a/pkgs/id/hosted-worker/test/usage.test.ts b/pkgs/id/hosted-worker/test/usage.test.ts index 112da27727..8942dac073 100644 --- a/pkgs/id/hosted-worker/test/usage.test.ts +++ b/pkgs/id/hosted-worker/test/usage.test.ts @@ -191,7 +191,11 @@ test("kv usage and the ceiling count UTF-8 bytes, not characters (#11349)", asyn // Overwriting a 20-byte value with 2 ASCII bytes frees 18 bytes of headroom. assert.equal((await doA.fetch(routed("/v1/kv/k0", { method: "PUT", body: "ab" }))).status, 200); assert.equal((await getUsage(doA)).kv_bytes, 82); - assert.equal((await doA.fetch(routed("/v1/kv/k1", { method: "PUT", body: "\u00e9".repeat(19) }))).status, 200, "38 bytes fits 18 freed + 20 prior"); + assert.equal( + (await doA.fetch(routed("/v1/kv/k1", { method: "PUT", body: "\u00e9".repeat(19) }))).status, + 200, + "38 bytes fits 18 freed + 20 prior", + ); assert.equal((await getUsage(doA)).kv_bytes, 100); }); diff --git a/pkgs/id/src/structured_logging.rs b/pkgs/id/src/structured_logging.rs index f3f383e7c0..cfdcf35068 100644 --- a/pkgs/id/src/structured_logging.rs +++ b/pkgs/id/src/structured_logging.rs @@ -609,9 +609,13 @@ mod tests { std::fs::create_dir_all(&dir).expect("create temp dir"); let mut writer = SharedFileWriter::open(&path).expect("open log file"); - writer.write_all(b"before delete\n").expect("write before delete"); + writer + .write_all(b"before delete\n") + .expect("write before delete"); std::fs::remove_file(&path).expect("delete log"); - writer.write_all(b"after delete\n").expect("write after delete"); + writer + .write_all(b"after delete\n") + .expect("write after delete"); writer.write_all(b"no newline").expect("write partial tail"); drop(writer); diff --git a/pkgs/id/web/src/editor.test.ts b/pkgs/id/web/src/editor.test.ts index 1838364405..367da8ab7a 100644 --- a/pkgs/id/web/src/editor.test.ts +++ b/pkgs/id/web/src/editor.test.ts @@ -317,12 +317,17 @@ describe("ordered_list start parsing (#2005)", () => { expect(parseOrderedListStart(raw)).toBe(expected); }); - it.each(["abc", "2.5", "0x10", "1e3", "", "-3", "9007199254740993"])( - "falls back to 1 for invalid start=%s", - (raw) => { - expect(parseOrderedListStart(raw)).toBe(1); - }, - ); + it.each([ + "abc", + "2.5", + "0x10", + "1e3", + "", + "-3", + "9007199254740993", + ])("falls back to 1 for invalid start=%s", (raw) => { + expect(parseOrderedListStart(raw)).toBe(1); + }); it("falls back to 1 when the start attribute is absent", () => { expect(parseOrderedListStart(null)).toBe(1); @@ -384,15 +389,20 @@ describe("task_list start parsing (#4100)", () => { expect(olGetAttrs()(el)).toEqual({ order: expected }); }); - it.each(["abc", "2.5", "0x10", "1e3", "", "-3", "9007199254740993"])( - "falls back to 1 for invalid start=%s", - (raw) => { - const el = document.createElement("ol"); - el.classList.add("contains-task-list"); - el.setAttribute("start", raw); - expect(olGetAttrs()(el)).toEqual({ order: 1 }); - }, - ); + it.each([ + "abc", + "2.5", + "0x10", + "1e3", + "", + "-3", + "9007199254740993", + ])("falls back to 1 for invalid start=%s", (raw) => { + const el = document.createElement("ol"); + el.classList.add("contains-task-list"); + el.setAttribute("start", raw); + expect(olGetAttrs()(el)).toEqual({ order: 1 }); + }); it("defaults order to 1 without a start attribute", () => { const el = document.createElement("ol"); @@ -770,12 +780,19 @@ describe("image dimension parsing (#2010)", () => { expect(parseImageDimension(raw)).toBe(expected); }); - it.each(["200px", "50%", "2.5", "-5", "abc", "0x10", "1e3", "", "9007199254740993"])( - "drops invalid dimension=%s to null", - (raw) => { - expect(parseImageDimension(raw)).toBeNull(); - }, - ); + it.each([ + "200px", + "50%", + "2.5", + "-5", + "abc", + "0x10", + "1e3", + "", + "9007199254740993", + ])("drops invalid dimension=%s to null", (raw) => { + expect(parseImageDimension(raw)).toBeNull(); + }); it("drops an absent dimension to null", () => { expect(parseImageDimension(null)).toBeNull(); diff --git a/pkgs/id/web/src/shell-contract.ts b/pkgs/id/web/src/shell-contract.ts index 915c085452..31804fcf36 100644 --- a/pkgs/id/web/src/shell-contract.ts +++ b/pkgs/id/web/src/shell-contract.ts @@ -57,7 +57,18 @@ type Field = { /** The result of checking one frame. */ export type Check = { ok: true; type: string } | { ok: false; error: string }; -const FIELD_TYPES = new Set(["string", "hex", "bool", "u16", "u32", "u64", "i64", "string[]", "array", "object"]); +const FIELD_TYPES = new Set([ + "string", + "hex", + "bool", + "u16", + "u32", + "u64", + "i64", + "string[]", + "array", + "object", +]); const PHASES = new Set(["opening", "query", "install", "joined", "closed"]); const FRAME_CLASSES = new Set([ "event",