mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 18:25:21 -04:00
refactor(test): Replace inline snapshot with file snapshot (#5830)
Some checks failed
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
E2E Tests / Build test build of frontend (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (push) Has been cancelled
Run tests & build / Test and build with NodeJS 20 (push) Has been cancelled
E2E Tests / frontend-cypress (1) (push) Has been cancelled
E2E Tests / frontend-cypress (2) (push) Has been cancelled
E2E Tests / frontend-cypress (3) (push) Has been cancelled
Some checks failed
Docker / build-and-push (backend) (push) Has been cancelled
Docker / build-and-push (frontend) (push) Has been cancelled
E2E Tests / backend-sqlite (push) Has been cancelled
E2E Tests / backend-mariadb (push) Has been cancelled
E2E Tests / backend-postgres (push) Has been cancelled
E2E Tests / Build test build of frontend (push) Has been cancelled
Lint and check format / Lint files and check formatting (push) Has been cancelled
REUSE Compliance Check / reuse (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Static Analysis / Njsscan code scanning (push) Has been cancelled
Static Analysis / CodeQL analysis (push) Has been cancelled
Run tests & build / Test and build with NodeJS 20 (push) Has been cancelled
E2E Tests / frontend-cypress (1) (push) Has been cancelled
E2E Tests / frontend-cypress (2) (push) Has been cancelled
E2E Tests / frontend-cypress (3) (push) Has been cancelled
This commit is contained in:
parent
66822c3bbc
commit
8b6bedab39
6 changed files with 225 additions and 208 deletions
107
backend/src/notes/__snapshots__/notes.service.spec.ts.snap
Normal file
107
backend/src/notes/__snapshots__/notes.service.spec.ts.snap
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`NotesService toNoteDto works 1`] = `
|
||||
{
|
||||
"content": "mockContent",
|
||||
"editedByAtPosition": [],
|
||||
"metadata": {
|
||||
"aliases": [
|
||||
{
|
||||
"name": "testAlias",
|
||||
"noteId": "testId",
|
||||
"primaryAlias": true,
|
||||
},
|
||||
],
|
||||
"createdAt": undefined,
|
||||
"description": "mockDescription",
|
||||
"editedBy": [
|
||||
"hardcoded",
|
||||
],
|
||||
"id": "testId",
|
||||
"permissions": {
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
},
|
||||
"primaryAddress": "testAlias",
|
||||
"tags": [
|
||||
"tag1",
|
||||
],
|
||||
"title": "mockTitle",
|
||||
"updateUsername": "hardcoded",
|
||||
"updatedAt": 2019-02-04T20:34:12.000Z,
|
||||
"version": undefined,
|
||||
"viewCount": 1337,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`NotesService toNoteMetadataDto works 1`] = `
|
||||
{
|
||||
"aliases": [
|
||||
{
|
||||
"name": "testAlias",
|
||||
"noteId": "testId",
|
||||
"primaryAlias": true,
|
||||
},
|
||||
],
|
||||
"createdAt": undefined,
|
||||
"description": "mockDescription",
|
||||
"editedBy": [
|
||||
"hardcoded",
|
||||
],
|
||||
"id": "testId",
|
||||
"permissions": {
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
},
|
||||
"primaryAddress": "testAlias",
|
||||
"tags": [
|
||||
"tag1",
|
||||
],
|
||||
"title": "mockTitle",
|
||||
"updateUsername": "hardcoded",
|
||||
"updatedAt": 2019-02-04T20:34:12.000Z,
|
||||
"version": undefined,
|
||||
"viewCount": 1337,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`NotesService toNotePermissionsDto works 1`] = `
|
||||
{
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
|
@ -688,23 +688,7 @@ describe('NotesService', () => {
|
|||
it('works', async () => {
|
||||
const [note] = await getMockData();
|
||||
const permissions = await service.toNotePermissionsDto(note);
|
||||
expect(permissions).toMatchInlineSnapshot(`
|
||||
{
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
}
|
||||
`);
|
||||
expect(permissions).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -716,47 +700,7 @@ describe('NotesService', () => {
|
|||
]);
|
||||
|
||||
const metadataDto = await service.toNoteMetadataDto(note);
|
||||
expect(metadataDto).toMatchInlineSnapshot(`
|
||||
{
|
||||
"aliases": [
|
||||
{
|
||||
"name": "testAlias",
|
||||
"noteId": "testId",
|
||||
"primaryAlias": true,
|
||||
},
|
||||
],
|
||||
"createdAt": undefined,
|
||||
"description": "mockDescription",
|
||||
"editedBy": [
|
||||
"hardcoded",
|
||||
],
|
||||
"id": "testId",
|
||||
"permissions": {
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
},
|
||||
"primaryAddress": "testAlias",
|
||||
"tags": [
|
||||
"tag1",
|
||||
],
|
||||
"title": "mockTitle",
|
||||
"updateUsername": "hardcoded",
|
||||
"updatedAt": 2019-02-04T20:34:12.000Z,
|
||||
"version": undefined,
|
||||
"viewCount": 1337,
|
||||
}
|
||||
`);
|
||||
expect(metadataDto).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('returns publicId if no alias exists', async () => {
|
||||
|
@ -774,51 +718,7 @@ describe('NotesService', () => {
|
|||
]);
|
||||
|
||||
const noteDto = await service.toNoteDto(note);
|
||||
expect(noteDto).toMatchInlineSnapshot(`
|
||||
{
|
||||
"content": "mockContent",
|
||||
"editedByAtPosition": [],
|
||||
"metadata": {
|
||||
"aliases": [
|
||||
{
|
||||
"name": "testAlias",
|
||||
"noteId": "testId",
|
||||
"primaryAlias": true,
|
||||
},
|
||||
],
|
||||
"createdAt": undefined,
|
||||
"description": "mockDescription",
|
||||
"editedBy": [
|
||||
"hardcoded",
|
||||
],
|
||||
"id": "testId",
|
||||
"permissions": {
|
||||
"owner": "hardcoded",
|
||||
"sharedToGroups": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"groupName": "testGroup",
|
||||
},
|
||||
],
|
||||
"sharedToUsers": [
|
||||
{
|
||||
"canEdit": true,
|
||||
"username": "hardcoded",
|
||||
},
|
||||
],
|
||||
},
|
||||
"primaryAddress": "testAlias",
|
||||
"tags": [
|
||||
"tag1",
|
||||
],
|
||||
"title": "mockTitle",
|
||||
"updateUsername": "hardcoded",
|
||||
"updatedAt": 2019-02-04T20:34:12.000Z,
|
||||
"version": undefined,
|
||||
"viewCount": 1337,
|
||||
},
|
||||
}
|
||||
`);
|
||||
expect(noteDto).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue