Skip to content

Commit d8424bb

Browse files
committed
test(openapi-fetch): removed custom additional test and updated existing one
1 parent d3eaa8a commit d8424bb

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

packages/openapi-fetch/test/common/request.test.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,30 +213,32 @@ describe("request", () => {
213213
});
214214

215215
test.each(BODY_ACCEPTING_METHODS)("`''` body (with body serializer) - %s", async (method) => {
216+
const body = ''
216217
const bodySerializer = vi.fn((body) => `Serialized: ${JSON.stringify(body)}`);
217218
const { bodyUsed, bodyText } = await fireRequestAndGetBodyInformation({
218219
bodySerializer,
219220
method,
220221
fetchOptions: {
221-
body: "",
222+
body,
222223
},
223224
});
224225

225226
expect(bodyUsed).toBe(true);
226-
expect(bodyText).toBe('Serialized: ""');
227+
expect(bodyText).toBe(`Serialized: ${body}`);
227228
expect(bodySerializer).toBeCalled();
228229
});
229230

230231
test.each(BODY_ACCEPTING_METHODS)("`''` body (without body serializer) - %s", async (method) => {
232+
const body = ''
231233
const { bodyUsed, bodyText } = await fireRequestAndGetBodyInformation({
232234
method,
233235
fetchOptions: {
234-
body: "",
236+
body,
235237
},
236238
});
237239

238240
expect(bodyUsed).toBe(true);
239-
expect(bodyText).toBe('""');
241+
expect(bodyText).toBe(body);
240242
});
241243

242244
test.each(BODY_ACCEPTING_METHODS)("`0` body (with body serializer) - %s", async (method) => {
@@ -358,17 +360,3 @@ describe("request", () => {
358360
});
359361
});
360362
});
361-
362-
test("serialized body is not serialized again", async () => {
363-
let body = "pre-serialized body",
364-
bodySerialized = "";
365-
366-
const client = createObservedClient<any>({}, async (req) => {
367-
bodySerialized = await req.text();
368-
return Response.json({});
369-
});
370-
await client.POST("/resources", {
371-
body,
372-
});
373-
expect(bodySerialized).toBe(body);
374-
});

0 commit comments

Comments
 (0)