浏览代码

test(app): fix TS2322 in bulk-export cleanup cron integ test

`ReturnType<typeof User.create>` resolves to `void` because Mongoose's
`Model.create` is overloaded, so `let user: Awaited<...>` was typed `void`
and assigning the created document failed `tsc` (ci-app-lint). Derive the
type from the schema via `HydratedDocument<InferSchemaType<typeof userSchema>>`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
tomoyuki-t 4 天之前
父节点
当前提交
bd61259f28

+ 3 - 1
apps/app/src/features/page-bulk-export/server/service/page-bulk-export-job-clean-up-cron.integ.ts

@@ -43,7 +43,9 @@ describe('PageBulkExportJobCleanUpCronService', () => {
       removeAttachment: removeAttachmentMock,
     },
   });
-  let user: Awaited<ReturnType<typeof User.create>>;
+  let user: mongoose.HydratedDocument<
+    mongoose.InferSchemaType<typeof userSchema>
+  >;
 
   beforeAll(async () => {
     await configManager.loadConfigs();