Преглед на файлове

test(app): drop unnecessary as any casts in attachment.spec

The two mockResolvedValue(... as any) casts on the Attachment.findById
spy were not needed: removing them still type-checks (Mongoose's
overloaded findById already widens the resolved value type), so the
casts only added an `as any` hole and a biome-ignore. Aligns with the
type-safe mocking rule added in 4cbd0e1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tomoyuki-t преди 3 дни
родител
ревизия
87029ba408
променени са 1 файла, в които са добавени 2 реда и са изтрити 4 реда
  1. 2 4
      apps/app/src/server/service/attachment.spec.ts

+ 2 - 4
apps/app/src/server/service/attachment.spec.ts

@@ -15,8 +15,7 @@ describe('AttachmentService.removeAttachment', () => {
   test('should resolve without throwing when the attachment is already gone', async () => {
     const findByIdSpy = vi
       .spyOn(Attachment, 'findById')
-      // biome-ignore lint/suspicious/noExplicitAny: Mongoose query shape is irrelevant to the contract under test
-      .mockResolvedValue(null as any);
+      .mockResolvedValue(null);
     const deleteFile = vi.fn();
     const crowi = mock<Crowi>({
       fileUploadService: { deleteFile },
@@ -38,8 +37,7 @@ describe('AttachmentService.removeAttachment', () => {
     });
     const findByIdSpy = vi
       .spyOn(Attachment, 'findById')
-      // biome-ignore lint/suspicious/noExplicitAny: Mongoose query shape is irrelevant to the contract under test
-      .mockResolvedValue(fakeAttachment as any);
+      .mockResolvedValue(fakeAttachment);
     const deleteFile = vi
       .fn()
       .mockRejectedValue(new Error('S3 is temporarily unavailable'));