Merge pull request #943 from hedgedoc/refactor/getNoteContent

This commit is contained in:
David Mehren 2021-02-23 21:05:25 +01:00 committed by GitHub
commit 3fabf2596a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 35 deletions

View file

@ -180,7 +180,7 @@ describe('NotesService', () => {
});
});
describe('getNoteContentByNote', () => {
describe('getNoteContent', () => {
it('works', async () => {
const content = 'testContent';
jest
@ -189,7 +189,7 @@ describe('NotesService', () => {
const newNote = await service.createNote(content);
const revisions = await newNote.revisions;
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
service.getNoteContentByNote(newNote).then((result) => {
service.getNoteContent(newNote).then((result) => {
expect(result).toEqual(content);
});
});
@ -575,22 +575,6 @@ describe('NotesService', () => {
});
});
describe('getNoteContentByIdOrAlias', () => {
it('works', async () => {
const content = 'testContent';
jest
.spyOn(noteRepo, 'save')
.mockImplementation(async (note: Note): Promise<Note> => note);
const newNote = await service.createNote(content);
const revisions = await newNote.revisions;
jest.spyOn(noteRepo, 'findOne').mockResolvedValueOnce(newNote);
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
service.getNoteContentByIdOrAlias('noteThatExists').then((result) => {
expect(result).toEqual(content);
});
});
});
describe('toTagList', () => {
it('works', async () => {
const note = {} as Note;