Skip to content

Commit aa94ce2

Browse files
committed
chore: update tests
1 parent 335710e commit aa94ce2

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

test/server.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe("server", () => {
3838
};
3939

4040
describe("createIPXH3Handler", () => {
41-
it("IPX_MISSING_MODIFIERS", () => {
41+
it("IPX_MISSING_MODIFIERS", async () => {
4242
const handler = createIPXH3Handler(ipx);
4343
const event = {
4444
path: "",
@@ -49,14 +49,14 @@ describe("server", () => {
4949
context: {},
5050
} as unknown as H3Event;
5151

52-
expect(handler(event)).resolves.toEqual({
52+
await expect(handler(event)).resolves.toEqual({
5353
error: {
5454
message: "[400] [IPX_MISSING_MODIFIERS] Modifiers are missing: ",
5555
},
5656
});
5757
});
5858

59-
it("IPX_MISSING_ID", () => {
59+
it("IPX_MISSING_ID", async () => {
6060
const handler = createIPXH3Handler(ipx);
6161
const event = {
6262
path: "/path",
@@ -67,14 +67,14 @@ describe("server", () => {
6767
context: {},
6868
} as unknown as H3Event;
6969

70-
expect(handler(event)).resolves.toEqual({
70+
await expect(handler(event)).resolves.toEqual({
7171
error: {
7272
message: "[400] [IPX_MISSING_ID] Resource id is missing: /path",
7373
},
7474
});
7575
});
7676

77-
it("[IPX_ERROR] ipx is not a function", () => {
77+
it("[IPX_ERROR] ipx is not a function", async () => {
7878
const handler = createIPXH3Handler(ipx);
7979
const event = {
8080
path: "/foo/bar/baz",
@@ -85,15 +85,15 @@ describe("server", () => {
8585
context: {},
8686
} as unknown as H3Event;
8787

88-
expect(handler(event)).resolves.toEqual({
88+
await expect(handler(event)).resolves.toEqual({
8989
error: {
9090
message:
9191
"[500] [IPX_ERROR] event.node.res.getHeader is not a function",
9292
},
9393
});
9494
});
9595

96-
it("createIPXH3Handler returns expected value", () => {
96+
it("createIPXH3Handler returns expected value", async () => {
9797
const handler = createIPXH3Handler(ipx);
9898
const event = {
9999
path: "/foo/bar/baz",
@@ -108,7 +108,7 @@ describe("server", () => {
108108
context: {},
109109
} as unknown as H3Event;
110110

111-
expect(handler(event)).resolves.toEqual("data");
111+
await expect(handler(event)).resolves.toEqual("data");
112112
});
113113
});
114114

test/storage/http.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ describe("http", () => {
55
describe("getMeta", () => {
66
const storage = ipxHttpStorage({});
77
const sut = storage.getMeta;
8-
it("id has no hostname, throw Error ", () => {
9-
expect(sut("file://")).rejects.toThrow("Hostname is missing: file://");
8+
it("id has no hostname, throw Error ", async () => {
9+
await expect(sut("file://")).rejects.toThrow(
10+
"Hostname is missing: file://",
11+
);
1012
});
11-
it("id is not allowed domain, throw Error ", () => {
12-
expect(sut("http://localhost")).rejects.toThrow(
13+
it("id is not allowed domain, throw Error ", async () => {
14+
await expect(sut("http://localhost")).rejects.toThrow(
1315
"Forbidden host: localhost",
1416
);
1517
});

0 commit comments

Comments
 (0)