refactor: update title controller tests to use async assertion matchers and refine userId type in anilist service.
This commit is contained in:
@@ -51,7 +51,7 @@ describe('requests the "/title" route', () => {
|
|||||||
headers: new Headers({ "x-anilist-token": "asd" }),
|
headers: new Headers({ "x-anilist-token": "asd" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(await response.json()).toMatchSnapshot();
|
await expect(response.json()).resolves.toMatchSnapshot();
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ describe('requests the "/title" route', () => {
|
|||||||
|
|
||||||
const response = await app.request("/title?id=10");
|
const response = await app.request("/title?id=10");
|
||||||
|
|
||||||
expect(await response.json()).toMatchSnapshot();
|
await expect(response.json()).resolves.toMatchSnapshot();
|
||||||
expect(response.status).toBe(200);
|
expect(response.status).toBe(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ describe('requests the "/title" route', () => {
|
|||||||
|
|
||||||
const response = await app.request("/title?id=-1");
|
const response = await app.request("/title?id=-1");
|
||||||
|
|
||||||
expect(await response.json()).toEqual({ success: false });
|
await expect(response.json()).resolves.toEqual({ success: false });
|
||||||
expect(response.status).toBe(404);
|
expect(response.status).toBe(404);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export class AnilistDurableObject extends DurableObject {
|
|||||||
|
|
||||||
async getTitle(
|
async getTitle(
|
||||||
id: number,
|
id: number,
|
||||||
userId?: string,
|
userId?: number,
|
||||||
token?: string,
|
token?: string,
|
||||||
): Promise<Title | null> {
|
): Promise<Title | null> {
|
||||||
const promises: Promise<any>[] = [
|
const promises: Promise<any>[] = [
|
||||||
|
|||||||
Reference in New Issue
Block a user