mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
test: fix e2e tests to handle the new aliases
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
b95a6f56b6
commit
9f38b9036c
6 changed files with 465 additions and 24 deletions
|
@ -157,15 +157,15 @@ describe('Me', () => {
|
|||
.send(historyEntryUpdateDto)
|
||||
.expect(200);
|
||||
const history = await historyService.getEntriesByUser(user);
|
||||
let historyEntry: HistoryEntryDto = response.body;
|
||||
const historyEntry: HistoryEntryDto = response.body;
|
||||
expect(historyEntry.pinStatus).toEqual(true);
|
||||
historyEntry = null;
|
||||
for (const e of history) {
|
||||
if (e.note.alias === noteName) {
|
||||
historyEntry = historyService.toHistoryEntryDto(e);
|
||||
let theEntry: HistoryEntryDto;
|
||||
for (const entry of history) {
|
||||
if (entry.note.aliases.find((element) => element.name === noteName)) {
|
||||
theEntry = historyService.toHistoryEntryDto(entry);
|
||||
}
|
||||
}
|
||||
expect(historyEntry.pinStatus).toEqual(true);
|
||||
expect(theEntry.pinStatus).toEqual(true);
|
||||
});
|
||||
it('fails with a non-existing note', async () => {
|
||||
await request(app.getHttpServer())
|
||||
|
@ -185,13 +185,11 @@ describe('Me', () => {
|
|||
.expect(204);
|
||||
expect(response.body).toEqual({});
|
||||
const history = await historyService.getEntriesByUser(user);
|
||||
let historyEntry: HistoryEntry = null;
|
||||
for (const e of history) {
|
||||
if (e.note.alias === noteName) {
|
||||
historyEntry = e;
|
||||
for (const entry of history) {
|
||||
if (entry.note.aliases.find((element) => element.name === noteName)) {
|
||||
throw new Error('Deleted history entry still in history');
|
||||
}
|
||||
}
|
||||
return expect(historyEntry).toBeNull();
|
||||
});
|
||||
describe('fails', () => {
|
||||
it('with a non-existing note', async () => {
|
||||
|
@ -218,8 +216,8 @@ describe('Me', () => {
|
|||
.expect(200);
|
||||
const noteMetaDtos = response.body as NoteMetadataDto[];
|
||||
expect(noteMetaDtos).toHaveLength(1);
|
||||
expect(noteMetaDtos[0].alias).toEqual(noteName);
|
||||
expect(noteMetaDtos[0].updateUser.userName).toEqual(user.userName);
|
||||
expect(noteMetaDtos[0].primaryAlias).toEqual(noteName);
|
||||
expect(noteMetaDtos[0].updateUser?.userName).toEqual(user.userName);
|
||||
});
|
||||
|
||||
it('GET /me/media', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue