mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
Note E2E tests: Check that create & update dates are updated correctly
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
65c76d0998
commit
c9a998ab73
1 changed files with 48 additions and 27 deletions
|
@ -120,7 +120,8 @@ describe('Notes', () => {
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}/metadata`, async () => {
|
describe('GET /notes/{note}/metadata', () => {
|
||||||
|
it(`returns complete metadata object`, async () => {
|
||||||
await notesService.createNote('This is a test note.', 'test6');
|
await notesService.createNote('This is a test note.', 'test6');
|
||||||
const metadata = await request(app.getHttpServer())
|
const metadata = await request(app.getHttpServer())
|
||||||
.get('/notes/test6/metadata')
|
.get('/notes/test6/metadata')
|
||||||
|
@ -150,6 +151,26 @@ describe('Notes', () => {
|
||||||
.expect(404);
|
.expect(404);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has the correct update/create dates', async () => {
|
||||||
|
// create a note
|
||||||
|
const note = await notesService.createNote(
|
||||||
|
'This is a test note.',
|
||||||
|
'test6a',
|
||||||
|
);
|
||||||
|
// save the creation time
|
||||||
|
const createDate = (await note.revisions)[0].createdAt;
|
||||||
|
// wait one second
|
||||||
|
await new Promise((r) => setTimeout(r, 1000));
|
||||||
|
// update the note
|
||||||
|
await notesService.updateNoteByIdOrAlias('test6a', 'More test content');
|
||||||
|
const metadata = await request(app.getHttpServer())
|
||||||
|
.get('/notes/test6a/metadata')
|
||||||
|
.expect(200);
|
||||||
|
expect(metadata.body.createTime).toEqual(createDate.toISOString());
|
||||||
|
expect(metadata.body.updateTime).not.toEqual(createDate.toISOString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it(`GET /notes/{note}/revisions`, async () => {
|
it(`GET /notes/{note}/revisions`, async () => {
|
||||||
await 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())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue