Skip to content

Commit

Permalink
Simplify stringifyJson test case
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
Reverier-Xu and sindresorhus committed Apr 23, 2024
1 parent bb063e5 commit 5aa7693
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/main.ts
Expand Up @@ -738,19 +738,16 @@ test('stringifyJson option with request.json()', async t => {
const server = await createHttpTestServer({bodyParser: false});

const json = {hello: 'world'};
const result = {data: json, extra: 'extraValue'};
const extra = 'extraValue';

server.post('/', async (request, response) => {
const body = await parseRawBody(request);
t.is(body, JSON.stringify(result));
t.is(body, JSON.stringify({data: json, extra}));
response.end();
});

await ky.post(server.url, {
stringifyJson: data => JSON.stringify({
data,
extra: 'extraValue',
}),
stringifyJson: data => JSON.stringify({data, extra}),
json,
});

Expand Down

0 comments on commit 5aa7693

Please sign in to comment.