NotesService: updateNoteByIdOrAlias should return the new note

Fixes #702

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-01-10 20:30:45 +01:00
parent a14056dbc9
commit 22e14fb706
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 3 additions and 1 deletions

View file

@ -195,6 +195,7 @@ export class NotesService {
revisions.push(Revision.create(noteContent, noteContent));
note.revisions = Promise.resolve(revisions);
await this.noteRepository.save(note);
return this.toNoteDto(note);
}
async getNoteMetadata(noteIdOrAlias: string): Promise<NoteMetadataDto> {

View file

@ -109,7 +109,7 @@ describe('Notes', () => {
it(`PUT /notes/{note}`, async () => {
await notesService.createNote('This is a test note.', 'test4');
await request(app.getHttpServer())
const response = await request(app.getHttpServer())
.put('/notes/test4')
.set('Content-Type', 'text/markdown')
.send('New note text')
@ -117,6 +117,7 @@ describe('Notes', () => {
await expect(
(await notesService.getNoteDtoByIdOrAlias('test4')).content,
).toEqual('New note text');
expect(response.body.content).toEqual('New note text');
// check if a missing note correctly returns 404
await request(app.getHttpServer())