From 79dd9af9881056afeae3e4d6124fb510b45f316b Mon Sep 17 00:00:00 2001 From: Yannick Bungers Date: Sat, 26 Sep 2020 23:40:15 +0200 Subject: [PATCH] Added await to wait for completion of note creation in tests Signed-off-by: Yannick Bungers --- test/public-api/users.e2e-spec.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/public-api/users.e2e-spec.ts b/test/public-api/users.e2e-spec.ts index 966ada3b2..fc43b2e67 100644 --- a/test/public-api/users.e2e-spec.ts +++ b/test/public-api/users.e2e-spec.ts @@ -42,7 +42,7 @@ describe('Notes', () => { /* TODO Note maybe not added to history by createNote, use function from HistoryService instead */ - notesService.createNote('', 'testGetHistory'); + await notesService.createNote('', 'testGetHistory'); const response = await request(app.getHttpServer()) .get('/me/history') .expect('Content-Type', /json/) @@ -61,7 +61,7 @@ describe('Notes', () => { /* TODO Note maybe not added to history by createNote, use function from HistoryService instead */ - notesService.createNote('', noteName); + await notesService.createNote('', noteName); const response = await request(app.getHttpServer()) .get('/me/history/' + noteName) .expect('Content-Type', /json/) @@ -75,7 +75,7 @@ describe('Notes', () => { /* TODO Note maybe not added to history by createNote, use function from HistoryService instead */ - notesService.createNote('This is a test note.', noteName); + await notesService.createNote('This is a test note.', noteName); const response = await request(app.getHttpServer()) .delete('/me/history/test3') .expect(204); @@ -93,7 +93,7 @@ describe('Notes', () => { it.skip(`PUT /me/history/{note}`, async () => { const noteName = 'testPutNoteHistory'; // TODO use function from HistoryService to add an History Entry - notesService.createNote('', noteName); + await notesService.createNote('', noteName); let historyEntryUpdateDto = new HistoryEntryUpdateDto(); historyEntryUpdateDto.pinStatus = true; let response = await request(app.getHttpServer()) @@ -120,7 +120,8 @@ describe('Notes', () => { it.skip(`GET /me/notes/`, async () => { - notesService.createNote('This is a test note.', 'test7'); + // TODO use function from HistoryService to add an History Entry + await notesService.createNote('This is a test note.', 'test7'); // usersService.getALLNotesOwnedByUser() TODO Implement function const response = await request(app.getHttpServer()) .get('/me/notes/')