refactor: remove cycling dependency between notes and revisions

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-06-21 16:05:21 +02:00 committed by David Mehren
parent 8cdc90bb8e
commit 8596bed729
7 changed files with 10 additions and 66 deletions

View file

@ -359,38 +359,6 @@ describe('NotesService', () => {
});
});
describe('getLatestRevision', () => {
it('works', async () => {
const content = 'testContent';
jest
.spyOn(noteRepo, 'save')
.mockImplementation(async (note: Note): Promise<Note> => note);
const newNote = await service.createNote(content, null);
const revisions = await newNote.revisions;
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
await service.getLatestRevision(newNote).then((result) => {
expect(result).toEqual(revisions[0]);
});
});
});
describe('getFirstRevision', () => {
it('works', async () => {
const user = {} as User;
user.username = 'hardcoded';
const content = 'testContent';
jest
.spyOn(noteRepo, 'save')
.mockImplementation(async (note: Note): Promise<Note> => note);
const newNote = await service.createNote(content, null);
const revisions = await newNote.revisions;
jest.spyOn(revisionRepo, 'findOne').mockResolvedValueOnce(revisions[0]);
await service.getLatestRevision(newNote).then((result) => {
expect(result).toEqual(revisions[0]);
});
});
});
describe('getNoteByIdOrAlias', () => {
it('works', async () => {
const user = User.create('hardcoded', 'Testy') as User;