update deps, migrate to pnpm

This commit is contained in:
Jorrin
2024-03-29 21:23:32 +01:00
parent f8a5120064
commit 21f1fd3cee
35 changed files with 15210 additions and 25328 deletions

View File

@@ -1,39 +1,39 @@
import { serializeBody } from "@/fetchers/body";
import FormData from "form-data";
import { describe, expect, it } from "vitest";
import { serializeBody } from '@/fetchers/body';
import FormData from 'form-data';
import { describe, expect, it } from 'vitest';
describe("serializeBody()", () => {
describe('serializeBody()', () => {
it('should work with standard text', () => {
expect(serializeBody("hello world")).toEqual({
expect(serializeBody('hello world')).toEqual({
headers: {},
body: "hello world"
})
})
body: 'hello world',
});
});
it('should work with objects', () => {
expect(serializeBody({ hello: "world", a: 42 })).toEqual({
expect(serializeBody({ hello: 'world', a: 42 })).toEqual({
headers: {
"Content-Type": "application/json"
'Content-Type': 'application/json',
},
body: JSON.stringify({ hello: "world", a: 42 })
})
})
body: JSON.stringify({ hello: 'world', a: 42 }),
});
});
it('should work x-www-form-urlencoded', () => {
const obj = new URLSearchParams()
obj.set("a", "b");
const obj = new URLSearchParams();
obj.set('a', 'b');
expect(serializeBody(obj)).toEqual({
headers: {},
body: obj
})
})
body: obj,
});
});
it('should work multipart/form-data', () => {
const obj = new FormData()
obj.append("a", "b");
const obj = new FormData();
obj.append('a', 'b');
expect(serializeBody(obj)).toEqual({
headers: {},
body: obj
})
})
})
body: obj,
});
});
});