Shun Miyazawa преди 2 дни
родител
ревизия
277523ab11
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      apps/app/src/server/routes/apiv3/page/respond-with-single-page.spec.ts

+ 4 - 2
apps/app/src/server/routes/apiv3/page/respond-with-single-page.spec.ts

@@ -23,7 +23,8 @@ vi.mock('~/utils/logger', () => ({
 
 
 import { respondWithSinglePage } from './respond-with-single-page';
 import { respondWithSinglePage } from './respond-with-single-page';
 
 
-// Express Response has extensive required properties that aren't used in these tests
+// ApiV3Response extends Express Response which requires 50+ properties (status, json, send, …).
+// Only apiv3/apiv3Err are exercised in these tests, so a full implementation is impractical.
 function createMockRes(): ApiV3Response {
 function createMockRes(): ApiV3Response {
   return {
   return {
     apiv3: vi.fn().mockReturnValue(undefined),
     apiv3: vi.fn().mockReturnValue(undefined),
@@ -31,7 +32,8 @@ function createMockRes(): ApiV3Response {
   } as unknown as ApiV3Response;
   } as unknown as ApiV3Response;
 }
 }
 
 
-// HydratedDocument adds Mongoose internals that aren't relevant to these tests
+// HydratedDocument<PageDocument> inherits Mongoose Document internals (save, $isNew, toObject, …).
+// Only path / initLatestRevisionField / populateDataToShowRevision are exercised here.
 function createMockPage(path = '/normal-page'): HydratedDocument<PageDocument> {
 function createMockPage(path = '/normal-page'): HydratedDocument<PageDocument> {
   const page = {
   const page = {
     path,
     path,