diff --git a/backend/src/frontend-config/frontend-config.service.spec.ts b/backend/src/frontend-config/frontend-config.service.spec.ts index a491082b9..3ea587e0a 100644 --- a/backend/src/frontend-config/frontend-config.service.spec.ts +++ b/backend/src/frontend-config/frontend-config.service.spec.ts @@ -116,6 +116,7 @@ describe('FrontendConfigService', () => { loggedIn: DefaultAccessLevel.WRITE, }, }, + revisionRetentionDays: 0, } as NoteConfig; }), ], @@ -223,6 +224,7 @@ describe('FrontendConfigService', () => { loggedIn: DefaultAccessLevel.WRITE, }, }, + revisionRetentionDays: 0, }; const module: TestingModule = await Test.createTestingModule({ imports: [ diff --git a/backend/src/revisions/__snapshots__/revisions.service.spec.ts.snap b/backend/src/revisions/__snapshots__/revisions.service.spec.ts.snap index f7d179555..5daabee55 100644 --- a/backend/src/revisions/__snapshots__/revisions.service.spec.ts.snap +++ b/backend/src/revisions/__snapshots__/revisions.service.spec.ts.snap @@ -14,3 +14,34 @@ exports[`RevisionsService purgeRevisions purges the revision history 1`] = ` +new content " `; + +exports[`RevisionsService removeOldRevisions remove a part of old revisions 1`] = ` +"Index: test-note +=================================================================== +--- test-note ++++ test-note +@@ -1,1 +1,6 @@ +-old content ++--- ++title: new title ++description: new description ++tags: [ "tag1" ] ++--- ++new content +" +`; + +exports[`RevisionsService removeOldRevisions remove all revisions except latest revision 1`] = ` +"Index: test-note +=================================================================== +--- test-note ++++ test-note +@@ -0,0 +1,6 @@ ++--- ++title: new title ++description: new description ++tags: [ "tag1" ] ++--- ++new content +" +`; diff --git a/backend/src/revisions/revisions.service.spec.ts b/backend/src/revisions/revisions.service.spec.ts index b6ad9398f..40c5468a1 100644 --- a/backend/src/revisions/revisions.service.spec.ts +++ b/backend/src/revisions/revisions.service.spec.ts @@ -455,12 +455,12 @@ describe('RevisionsService', () => { }); it('handleCron should call removeOldRevisions', async () => { - await service.handleCron(); + await service.handleRevisionCleanup(); expect(service.removeOldRevisions).toHaveBeenCalledTimes(1); }); it('handleTimeout should call removeOldRevisions', async () => { - await service.handleTimeout(); + await service.handleRevisionCleanupTimeout(); expect(service.removeOldRevisions).toHaveBeenCalledTimes(1); }); }); @@ -528,7 +528,7 @@ describe('RevisionsService', () => { jest.spyOn(revisionRepo, 'save').mockResolvedValue(revision3); await service.removeOldRevisions(); - expect(revision3.patch).toMatchSnapshot; + expect(revision3.patch).toMatchSnapshot(); }); it('remove a part of old revisions', async () => { @@ -576,7 +576,7 @@ describe('RevisionsService', () => { jest.spyOn(revisionRepo, 'save').mockResolvedValue(revision2); await service.removeOldRevisions(); - expect(revision2.patch).toMatchSnapshot; + expect(revision2.patch).toMatchSnapshot(); }); it('do nothing when only one revision', async () => {