mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 03:57:06 -04:00
refactor(note): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
d761ff7f4f
commit
235e4f647c
23 changed files with 343 additions and 284 deletions
|
@ -29,12 +29,12 @@ describe('getPrimaryAlias', () => {
|
|||
const user = User.create('hardcoded', 'Testy') as User;
|
||||
note = Note.create(user, alias) as Note;
|
||||
});
|
||||
it('finds correct primary alias', () => {
|
||||
note.aliases.push(Alias.create('annother', note, false) as Alias);
|
||||
expect(getPrimaryAlias(note)).toEqual(alias);
|
||||
it('finds correct primary alias', async () => {
|
||||
(await note.aliases).push(Alias.create('annother', note, false) as Alias);
|
||||
expect(await getPrimaryAlias(note)).toEqual(alias);
|
||||
});
|
||||
it('returns undefined if there is no alias', () => {
|
||||
note.aliases[0].primary = false;
|
||||
expect(getPrimaryAlias(note)).toEqual(undefined);
|
||||
it('returns undefined if there is no alias', async () => {
|
||||
(await note.aliases)[0].primary = false;
|
||||
expect(await getPrimaryAlias(note)).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue