From e08098157a5b9e60f40f127b39284adeb9b62d61 Mon Sep 17 00:00:00 2001 From: Vincent Chalamon <407859+vincentchalamon@users.noreply.github.com> Date: Sat, 26 Sep 2026 16:56:42 +0200 Subject: [PATCH] fix(test): assert the default Accept header on the parameters fetch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release workflow fails on "Resource parameters can be retrieved": AssertionError: expected last "spy" call to have been called with [ 'http://localhost/books', …(1) ] - "headers": {}, + "headers": Headers {}, Two pull requests crossed. #179 added the assertion expecting a plain "headers: {}", and #178 merged twenty seconds later made setHeaders() always build a Headers instance carrying the default Accept. Both were green against main as it stood when each ran, so neither CI saw the other. Assert what the two changes together are meant to guarantee: the parameters fetch targets the collection and carries the default Accept header. Comparing against a Headers instance is not an option, it has no enumerable own properties and the matcher reports "no visual difference" while failing. --- src/hydra/parseHydraDocumentation.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hydra/parseHydraDocumentation.test.ts b/src/hydra/parseHydraDocumentation.test.ts index 399af6a..4c2f4fe 100644 --- a/src/hydra/parseHydraDocumentation.test.ts +++ b/src/hydra/parseHydraDocumentation.test.ts @@ -1591,9 +1591,16 @@ test("Resource parameters can be retrieved", async () => { const parameters = await resource.getParameters(); expect(fetchSpy).toHaveBeenCalledTimes(3); - expect(fetchSpy).toHaveBeenLastCalledWith("http://localhost/books", { - headers: {}, - }); + const lastCall = fetchSpy.mock.lastCall; + assert(lastCall !== undefined); + + const [lastUrl, lastOptions] = lastCall; + assert(lastOptions !== undefined); + + expect(lastUrl).toBe("http://localhost/books"); + expect(new Headers(lastOptions.headers).get("Accept")).toBe( + "application/ld+json", + ); expect(parameters).toEqual([ { description: "",