mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-21 06:13:48 +00:00
chore: add typecheck script and fix pre-existing TypeScript errors
- Add `typecheck` script (`tsc --noEmit`) to package.json - Remove conflicting `declare global` from test/setup.ts (superseded by @cloudflare/workers-types); use `globalThis as any` for test globals and declare minimal `require` locally to avoid pulling in @types/node - Cast `createMockEnv()` and `deleteRes.json()` results in admin.test.ts to silence strict `unknown` / MockKV-vs-KVNamespace errors Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,10 +11,10 @@ describe("Admin Routes", () => {
|
||||
let loginAndGetCookie: () => Promise<string>;
|
||||
|
||||
beforeEach(() => {
|
||||
mockEnv = createMockEnv();
|
||||
mockEnv = createMockEnv() as unknown as Env;
|
||||
testApp = new Hono();
|
||||
testApp.route("/admin", app);
|
||||
request = (path, init = {}) => testApp.request(path, init, mockEnv);
|
||||
request = (path, init = {}) => Promise.resolve(testApp.request(path, init, mockEnv));
|
||||
loginAndGetCookie = async () => {
|
||||
const formData = new FormData();
|
||||
formData.append("password", "test-password");
|
||||
@@ -161,8 +161,8 @@ describe("Admin Routes", () => {
|
||||
"json",
|
||||
);
|
||||
expect(feedConfig).toBeTruthy();
|
||||
expect(feedConfig.title).toBe("Test Feed");
|
||||
expect(feedConfig.description).toBe("Test Description");
|
||||
expect((feedConfig as any).title).toBe("Test Feed");
|
||||
expect((feedConfig as any).description).toBe("Test Description");
|
||||
});
|
||||
|
||||
it("should reject feed creation with missing title", async () => {
|
||||
@@ -297,7 +297,7 @@ describe("Admin Routes", () => {
|
||||
);
|
||||
|
||||
expect(deleteRes.status).toBe(200);
|
||||
const payload = await deleteRes.json();
|
||||
const payload = (await deleteRes.json()) as any;
|
||||
expect(payload.ok).toBe(true);
|
||||
expect(payload.feedId).toBe(feedId);
|
||||
});
|
||||
@@ -419,7 +419,7 @@ describe("Admin Routes", () => {
|
||||
);
|
||||
|
||||
expect(deleteRes.status).toBe(200);
|
||||
const payload = await deleteRes.json();
|
||||
const payload = (await deleteRes.json()) as any;
|
||||
expect(payload.ok).toBe(true);
|
||||
expect(payload.emailKey).toBe(emailKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user