mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Note E2E tests: Await all note-creations and fix test for note-deletion.
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
05a62b31ee
commit
711358ec0c
1 changed files with 9 additions and 7 deletions
|
@ -51,7 +51,7 @@ describe('Notes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}`, async () => {
|
it(`GET /notes/{note}`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test1');
|
await notesService.createNote('This is a test note.', 'test1');
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.get('/notes/test1')
|
.get('/notes/test1')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -75,15 +75,17 @@ describe('Notes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`DELETE /notes/{note}`, async () => {
|
it(`DELETE /notes/{note}`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test3');
|
await notesService.createNote('This is a test note.', 'test3');
|
||||||
await request(app.getHttpServer())
|
await request(app.getHttpServer())
|
||||||
.delete('/notes/test3')
|
.delete('/notes/test3')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
return expect(notesService.getNoteByIdOrAlias('test3')).toBeNull();
|
return expect(notesService.getNoteByIdOrAlias('test3')).rejects.toEqual(
|
||||||
|
Error('Note not found'),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`PUT /notes/{note}`, async () => {
|
it(`PUT /notes/{note}`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test4');
|
await notesService.createNote('This is a test note.', 'test4');
|
||||||
await request(app.getHttpServer())
|
await request(app.getHttpServer())
|
||||||
.put('/notes/test4')
|
.put('/notes/test4')
|
||||||
.set('Content-Type', 'text/markdown')
|
.set('Content-Type', 'text/markdown')
|
||||||
|
@ -111,7 +113,7 @@ describe('Notes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}/revisions`, async () => {
|
it(`GET /notes/{note}/revisions`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test7');
|
await notesService.createNote('This is a test note.', 'test7');
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.get('/notes/test7/revisions')
|
.get('/notes/test7/revisions')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -120,7 +122,7 @@ describe('Notes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}/revisions/{revision-id}`, async () => {
|
it(`GET /notes/{note}/revisions/{revision-id}`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test8');
|
await notesService.createNote('This is a test note.', 'test8');
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.get('/notes/test8/revisions/1')
|
.get('/notes/test8/revisions/1')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
|
@ -129,7 +131,7 @@ describe('Notes', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}/content`, async () => {
|
it(`GET /notes/{note}/content`, async () => {
|
||||||
notesService.createNote('This is a test note.', 'test9');
|
await notesService.createNote('This is a test note.', 'test9');
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.get('/notes/test9/content')
|
.get('/notes/test9/content')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue