mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 17:14:27 -05:00
Note E2E tests: Set a non-JSON content-type to avoid Nest trying to parse markdown to JSON.
Nest automatically tries to parse incoming requests with application/json as content-type and responds with HTTP 400 if the parsing fails. As our test-note-content is not valid JSON, we need to set another content-type. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c43448624b
commit
cccd52d1b0
1 changed files with 4 additions and 0 deletions
|
@ -37,6 +37,7 @@ describe('Notes', () => {
|
||||||
const newNote = 'This is a test note.';
|
const newNote = 'This is a test note.';
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.post('/notes')
|
.post('/notes')
|
||||||
|
.set('Content-Type', 'text/markdown')
|
||||||
.send(newNote)
|
.send(newNote)
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect(201);
|
.expect(201);
|
||||||
|
@ -60,6 +61,7 @@ describe('Notes', () => {
|
||||||
const newNote = 'This is a test note.';
|
const newNote = 'This is a test note.';
|
||||||
const response = await request(app.getHttpServer())
|
const response = await request(app.getHttpServer())
|
||||||
.post('/notes/test2')
|
.post('/notes/test2')
|
||||||
|
.set('Content-Type', 'text/markdown')
|
||||||
.send(newNote)
|
.send(newNote)
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.expect(201);
|
.expect(201);
|
||||||
|
@ -82,6 +84,7 @@ describe('Notes', () => {
|
||||||
notesService.createNote('This is a test note.', 'test4');
|
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')
|
||||||
.send('New note text')
|
.send('New note text')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
return expect(
|
return expect(
|
||||||
|
@ -93,6 +96,7 @@ describe('Notes', () => {
|
||||||
// TODO
|
// TODO
|
||||||
return request(app.getHttpServer())
|
return request(app.getHttpServer())
|
||||||
.post('/notes/test5/metadata')
|
.post('/notes/test5/metadata')
|
||||||
|
.set('Content-Type', 'text/markdown')
|
||||||
.expect(200);
|
.expect(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue