mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 09:16:30 -05:00
fix(tests): fix tests and linting
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
4250f4458b
commit
b44f395852
3 changed files with 37 additions and 4 deletions
|
@ -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: [
|
||||
|
|
|
@ -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
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue