NotesService: Throw NotInDBError when the note wasn't found

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2020-10-17 18:47:10 +02:00
parent 273d9b2d19
commit 1f22f47327
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
3 changed files with 25 additions and 4 deletions

View file

@ -3,6 +3,7 @@ import { Test } from '@nestjs/testing';
import { TypeOrmModule } from '@nestjs/typeorm';
import * as request from 'supertest';
import { PublicApiModule } from '../../src/api/public/public-api.module';
import { NotInDBError } from '../../src/errors/errors';
import { GroupsModule } from '../../src/groups/groups.module';
import { LoggerModule } from '../../src/logger/logger.module';
import { NotesModule } from '../../src/notes/notes.module';
@ -82,7 +83,7 @@ describe('Notes', () => {
.delete('/notes/test3')
.expect(200);
return expect(notesService.getNoteByIdOrAlias('test3')).rejects.toEqual(
Error('Note not found'),
new NotInDBError("Note with id/alias 'test3' not found."),
);
});