refactor: update title controller tests to use async assertion matchers and refine userId type in anilist service.

This commit is contained in:
2025-12-19 00:06:57 -05:00
parent e5d9d62be2
commit c01e005afb
2 changed files with 4 additions and 4 deletions

View File

@@ -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);
}); });
}); });

View File

@@ -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>[] = [