From 306cb2808c33fb6501be0f3bf62df6abd27d1fa2 Mon Sep 17 00:00:00 2001 From: Jared Wray Date: Thu, 26 Feb 2026 09:18:16 -0800 Subject: [PATCH 1/2] memory - chore: upgrading hookified to 1.15.1 --- packages/memory/package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/memory/package.json b/packages/memory/package.json index a85b955e..c1db0f3a 100644 --- a/packages/memory/package.json +++ b/packages/memory/package.json @@ -44,7 +44,7 @@ "dependencies": { "@cacheable/utils": "workspace:^", "@keyv/bigmap": "^1.3.1", - "hookified": "^1.15.0", + "hookified": "^1.15.1", "keyv": "^5.6.0" }, "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e632af92..f47d57a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -264,8 +264,8 @@ importers: specifier: ^1.3.1 version: 1.3.1(keyv@5.6.0) hookified: - specifier: ^1.15.0 - version: 1.15.0 + specifier: ^1.15.1 + version: 1.15.1 keyv: specifier: ^5.6.0 version: 5.6.0 @@ -4451,7 +4451,7 @@ snapshots: '@cacheable/node-cache@1.5.6': dependencies: cacheable: 1.10.0 - hookified: 1.15.0 + hookified: 1.15.1 keyv: 5.5.5 '@cacheable/utils@2.3.3': @@ -4882,7 +4882,7 @@ snapshots: '@keyv/bigmap@1.3.1(keyv@5.6.0)': dependencies: hashery: 1.5.0 - hookified: 1.15.0 + hookified: 1.15.1 keyv: 5.6.0 '@keyv/redis@5.1.5(keyv@5.6.0)': @@ -5613,7 +5613,7 @@ snapshots: cacheable@1.10.0: dependencies: - hookified: 1.15.0 + hookified: 1.15.1 keyv: 5.6.0 cacheable@2.3.2: From 119681aac4d60409b09e913e732a005cd06e9f77 Mon Sep 17 00:00:00 2001 From: Jared Wray Date: Thu, 26 Feb 2026 09:39:51 -0800 Subject: [PATCH 2/2] fixing flaky mockhttp --- docker-compose.yml | 5 + packages/net/package.json | 4 +- packages/net/test/fetch.test.ts | 322 ++++++++++++++----------- packages/net/test/index.test.ts | 408 ++++++++++++++++++-------------- 4 files changed, 418 insertions(+), 321 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b356ddb1..81e0cfb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,3 +3,8 @@ services: image: redis ports: - '6379:6379' + mockhttp: + image: jaredwray/mockhttp + platform: linux/amd64 + ports: + - '3000:3000' diff --git a/packages/net/package.json b/packages/net/package.json index 97b319c2..3f7d5bda 100644 --- a/packages/net/package.json +++ b/packages/net/package.json @@ -30,8 +30,8 @@ "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean", "prepublish": "pnpm build", "lint": "biome check --write --error-on-warnings", - "test": "pnpm lint && vitest run --coverage", - "test:ci": "biome check --error-on-warnings && vitest run --coverage", + "test": "pnpm lint && TEST_URL=http://localhost:3000 vitest run --coverage", + "test:ci": "biome check --error-on-warnings && TEST_URL=http://localhost:3000 vitest run --coverage", "clean": "rimraf ./dist ./coverage ./node_modules" }, "devDependencies": { diff --git a/packages/net/test/fetch.test.ts b/packages/net/test/fetch.test.ts index c5077407..4a054693 100644 --- a/packages/net/test/fetch.test.ts +++ b/packages/net/test/fetch.test.ts @@ -320,100 +320,124 @@ describe("Fetch", () => { testTimeout, ); - test("should handle FormData in post helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/post`; - const formData = new FormData(); - formData.append("test", "data"); - - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - // The actual FormData handling is covered in the branch coverage - try { - const result = await post(url, formData, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle FormData in post helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/post`; + const formData = new FormData(); + formData.append("test", "data"); - test("should handle URLSearchParams in post helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/post`; - const params = new URLSearchParams(); - params.append("key", "value"); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + // The actual FormData handling is covered in the branch coverage + try { + const result = await post(url, formData, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await post(url, params, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle URLSearchParams in post helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/post`; + const params = new URLSearchParams(); + params.append("key", "value"); - test("should handle Blob in post helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/post`; - const blob = new Blob(["test data"], { type: "text/plain" }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await post(url, params, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await post(url, blob, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle Blob in post helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/post`; + const blob = new Blob(["test data"], { type: "text/plain" }); - test("should handle FormData in patch helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/patch`; - const formData = new FormData(); - formData.append("test", "data"); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await post(url, blob, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await patch(url, formData, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle FormData in patch helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/patch`; + const formData = new FormData(); + formData.append("test", "data"); - test("should handle URLSearchParams in patch helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/patch`; - const params = new URLSearchParams(); - params.append("key", "value"); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await patch(url, formData, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await patch(url, params, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle URLSearchParams in patch helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/patch`; + const params = new URLSearchParams(); + params.append("key", "value"); - test("should handle Blob in patch helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/patch`; - const blob = new Blob(["test data"], { type: "text/plain" }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await patch(url, params, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await patch(url, blob, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + test( + "should handle Blob in patch helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/patch`; + const blob = new Blob(["test data"], { type: "text/plain" }); + + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await patch(url, blob, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); test( "should fetch data using delete helper", @@ -515,69 +539,85 @@ describe("Fetch", () => { testTimeout, ); - test("should handle string data in delete helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/delete`; - const data = JSON.stringify({ id: "123" }); - const options = { - cache, - headers: { - "Content-Type": "application/json", - }, - }; - const result = await del(url, data, options); - expect(result).toBeDefined(); - expect(result.data).toBeDefined(); - expect(result.response).toBeDefined(); - expect(result.response.status).toBe(200); - }); + test( + "should handle string data in delete helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/delete`; + const data = JSON.stringify({ id: "123" }); + const options = { + cache, + headers: { + "Content-Type": "application/json", + }, + }; + const result = await del(url, data, options); + expect(result).toBeDefined(); + expect(result.data).toBeDefined(); + expect(result.response).toBeDefined(); + expect(result.response.status).toBe(200); + }, + testTimeout, + ); - test("should handle FormData in delete helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/delete`; - const formData = new FormData(); - formData.append("id", "123"); + test( + "should handle FormData in delete helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/delete`; + const formData = new FormData(); + formData.append("id", "123"); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await del(url, formData, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await del(url, formData, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle URLSearchParams in delete helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/delete`; - const params = new URLSearchParams(); - params.append("id", "123"); + test( + "should handle URLSearchParams in delete helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/delete`; + const params = new URLSearchParams(); + params.append("id", "123"); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await del(url, params, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await del(url, params, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle Blob in delete helper", async () => { - const cache = new Cacheable(); - const url = `${testUrl}/delete`; - const blob = new Blob(["test data"], { type: "text/plain" }); + test( + "should handle Blob in delete helper", + async () => { + const cache = new Cacheable(); + const url = `${testUrl}/delete`; + const blob = new Blob(["test data"], { type: "text/plain" }); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await del(url, blob, { cache }); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await del(url, blob, { cache }); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); describe("HTTP Cache Headers", () => { test( diff --git a/packages/net/test/index.test.ts b/packages/net/test/index.test.ts index 0555117b..ba53d6d8 100644 --- a/packages/net/test/index.test.ts +++ b/packages/net/test/index.test.ts @@ -411,52 +411,64 @@ describe("Cacheable Net", () => { testTimeout, ); - test("should handle FormData in CacheableNet put method", async () => { - const net = new Net(); - const url = `${testUrl}/put`; - const formData = new FormData(); - formData.append("field", "value"); + test( + "should handle FormData in CacheableNet put method", + async () => { + const net = new Net(); + const url = `${testUrl}/put`; + const formData = new FormData(); + formData.append("field", "value"); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await net.put(url, formData); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await net.put(url, formData); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle URLSearchParams in CacheableNet put method", async () => { - const net = new Net(); - const url = `${testUrl}/put`; - const params = new URLSearchParams(); - params.append("test", "value"); + test( + "should handle URLSearchParams in CacheableNet put method", + async () => { + const net = new Net(); + const url = `${testUrl}/put`; + const params = new URLSearchParams(); + params.append("test", "value"); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await net.put(url, params); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await net.put(url, params); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle Blob in CacheableNet put method", async () => { - const net = new Net(); - const url = `${testUrl}/put`; - const blob = new Blob(["data"], { type: "text/plain" }); + test( + "should handle Blob in CacheableNet put method", + async () => { + const net = new Net(); + const url = `${testUrl}/put`; + const blob = new Blob(["data"], { type: "text/plain" }); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await net.put(url, blob); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await net.put(url, blob); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); test( "should use cache when caching is set to true in put method", @@ -635,52 +647,64 @@ describe("Cacheable Net", () => { testTimeout, ); - test("should handle FormData in CacheableNet post method", async () => { - const net = new Net(); - const url = `${testUrl}/post`; - const formData = new FormData(); - formData.append("field", "value"); + test( + "should handle FormData in CacheableNet post method", + async () => { + const net = new Net(); + const url = `${testUrl}/post`; + const formData = new FormData(); + formData.append("field", "value"); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await net.post(url, formData); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await net.post(url, formData); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle URLSearchParams in CacheableNet post method", async () => { - const net = new Net(); - const url = `${testUrl}/post`; - const params = new URLSearchParams(); - params.append("test", "value"); + test( + "should handle URLSearchParams in CacheableNet post method", + async () => { + const net = new Net(); + const url = `${testUrl}/post`; + const params = new URLSearchParams(); + params.append("test", "value"); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await net.post(url, params); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await net.post(url, params); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle Blob in CacheableNet post method", async () => { - const net = new Net(); - const url = `${testUrl}/post`; - const blob = new Blob(["data"], { type: "text/plain" }); + test( + "should handle Blob in CacheableNet post method", + async () => { + const net = new Net(); + const url = `${testUrl}/post`; + const blob = new Blob(["data"], { type: "text/plain" }); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await net.post(url, blob); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await net.post(url, blob); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); test( "should use cache when caching is set to true in post method", @@ -748,52 +772,64 @@ describe("Cacheable Net", () => { testTimeout, ); - test("should handle FormData in CacheableNet patch method", async () => { - const net = new Net(); - const url = `${testUrl}/patch`; - const formData = new FormData(); - formData.append("field", "value"); + test( + "should handle FormData in CacheableNet patch method", + async () => { + const net = new Net(); + const url = `${testUrl}/patch`; + const formData = new FormData(); + formData.append("field", "value"); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await net.patch(url, formData); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await net.patch(url, formData); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle URLSearchParams in CacheableNet patch method", async () => { - const net = new Net(); - const url = `${testUrl}/patch`; - const params = new URLSearchParams(); - params.append("test", "value"); + test( + "should handle URLSearchParams in CacheableNet patch method", + async () => { + const net = new Net(); + const url = `${testUrl}/patch`; + const params = new URLSearchParams(); + params.append("test", "value"); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await net.patch(url, params); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await net.patch(url, params); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle Blob in CacheableNet patch method", async () => { - const net = new Net(); - const url = `${testUrl}/patch`; - const blob = new Blob(["data"], { type: "text/plain" }); + test( + "should handle Blob in CacheableNet patch method", + async () => { + const net = new Net(); + const url = `${testUrl}/patch`; + const blob = new Blob(["data"], { type: "text/plain" }); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await net.patch(url, blob); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await net.patch(url, blob); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); test( "should use cache when caching is set to true in patch method", @@ -1043,67 +1079,83 @@ describe("Cacheable Net", () => { testTimeout, ); - test("should handle string data in CacheableNet delete method", async () => { - const net = new Net(); - const url = `${testUrl}/delete`; - const data = JSON.stringify({ id: "123" }); - const result = await net.delete(url, data, { - headers: { - "Content-Type": "application/json", - }, - }); - expect(result).toBeDefined(); - expect(result.data).toBeDefined(); - expect(result.response).toBeDefined(); - expect(result.response.status).toBe(200); - }); + test( + "should handle string data in CacheableNet delete method", + async () => { + const net = new Net(); + const url = `${testUrl}/delete`; + const data = JSON.stringify({ id: "123" }); + const result = await net.delete(url, data, { + headers: { + "Content-Type": "application/json", + }, + }); + expect(result).toBeDefined(); + expect(result.data).toBeDefined(); + expect(result.response).toBeDefined(); + expect(result.response.status).toBe(200); + }, + testTimeout, + ); - test("should handle FormData in CacheableNet delete method", async () => { - const net = new Net(); - const url = `${testUrl}/delete`; - const formData = new FormData(); - formData.append("id", "123"); + test( + "should handle FormData in CacheableNet delete method", + async () => { + const net = new Net(); + const url = `${testUrl}/delete`; + const formData = new FormData(); + formData.append("id", "123"); - // Since the server might not handle FormData properly, we'll just verify it doesn't crash - try { - const result = await net.delete(url, formData); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept FormData, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle FormData properly, we'll just verify it doesn't crash + try { + const result = await net.delete(url, formData); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept FormData, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle URLSearchParams in CacheableNet delete method", async () => { - const net = new Net(); - const url = `${testUrl}/delete`; - const params = new URLSearchParams(); - params.append("id", "123"); + test( + "should handle URLSearchParams in CacheableNet delete method", + async () => { + const net = new Net(); + const url = `${testUrl}/delete`; + const params = new URLSearchParams(); + params.append("id", "123"); - // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash - try { - const result = await net.delete(url, params); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept URLSearchParams, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle URLSearchParams properly, we'll just verify it doesn't crash + try { + const result = await net.delete(url, params); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept URLSearchParams, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); - test("should handle Blob in CacheableNet delete method", async () => { - const net = new Net(); - const url = `${testUrl}/delete`; - const blob = new Blob(["data"], { type: "text/plain" }); + test( + "should handle Blob in CacheableNet delete method", + async () => { + const net = new Net(); + const url = `${testUrl}/delete`; + const blob = new Blob(["data"], { type: "text/plain" }); - // Since the server might not handle Blob properly, we'll just verify it doesn't crash - try { - const result = await net.delete(url, blob); - expect(result).toBeDefined(); - } catch (error) { - // If server doesn't accept Blob, that's okay - we're testing the client code - expect(error).toBeDefined(); - } - }); + // Since the server might not handle Blob properly, we'll just verify it doesn't crash + try { + const result = await net.delete(url, blob); + expect(result).toBeDefined(); + } catch (error) { + // If server doesn't accept Blob, that's okay - we're testing the client code + expect(error).toBeDefined(); + } + }, + testTimeout, + ); test("should handle httpCachePolicy option in constructor", () => { // Test with httpCachePolicy set to false