@nymphjs/tilmeld 1.0.0-beta.121 → 1.0.0-beta.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  Entity,
3
3
  Nymph,
4
+ HttpError,
4
5
  TilmeldAccessLevels,
5
6
  TilmeldAccessRequest,
6
7
  } from '@nymphjs/nymph';
7
8
 
8
9
  import Tilmeld from './Tilmeld.js';
10
+ import { requireAbility, requireAuthentication } from './decorators/index.js';
9
11
  import { AccessControlError } from './errors/index.js';
10
12
  import type { AccessControlData } from './Tilmeld.types.js';
11
13
  import type UserClass from './User.js';
@@ -28,6 +30,26 @@ export class TestModel extends Entity<TestModelData> {
28
30
  */
29
31
  private $skipAcWhenDeleting = false;
30
32
 
33
+ @requireAuthentication
34
+ public $testRequireAuthenticationDecorator() {
35
+ return true;
36
+ }
37
+
38
+ @requireAuthentication
39
+ public async $testRequireAuthenticationDecoratorAsync() {
40
+ return true;
41
+ }
42
+
43
+ @requireAbility('test-ability')
44
+ public $testRequireAbilityDecorator() {
45
+ return true;
46
+ }
47
+
48
+ @requireAbility('test-ability')
49
+ public async $testRequireAbilityDecoratorAsync() {
50
+ return true;
51
+ }
52
+
31
53
  /*
32
54
  * This should *never* be accessible on the client.
33
55
  */
@@ -86,7 +108,7 @@ export function TilmeldTest(
86
108
  );
87
109
  expect(Array.isArray(all)).toEqual(true);
88
110
  for (const cur of all) {
89
- expect(await cur.$deleteSkipAC()).toEqual(true);
111
+ await cur.$deleteSkipAC();
90
112
  }
91
113
 
92
114
  all = await nymph.getEntities({ class: TestModel });
@@ -95,7 +117,7 @@ export function TilmeldTest(
95
117
  all = await nymph.getEntities({ class: User });
96
118
  expect(Array.isArray(all)).toEqual(true);
97
119
  for (const cur of all) {
98
- expect(await cur.$deleteSkipAC()).toEqual(true);
120
+ await cur.$deleteSkipAC();
99
121
  }
100
122
 
101
123
  all = await nymph.getEntities({ class: User });
@@ -104,7 +126,7 @@ export function TilmeldTest(
104
126
  all = await nymph.getEntities({ class: Group });
105
127
  expect(Array.isArray(all)).toEqual(true);
106
128
  for (const cur of all) {
107
- expect(await cur.$deleteSkipAC()).toEqual(true);
129
+ await cur.$deleteSkipAC();
108
130
  }
109
131
 
110
132
  all = await nymph.getEntities({ class: Group });
@@ -219,7 +241,7 @@ export function TilmeldTest(
219
241
 
220
242
  const bobsEntity = await TestModel.factory();
221
243
  bobsEntity.name = "Bob's Entity";
222
- expect(await bobsEntity.$save()).toEqual(true);
244
+ await bobsEntity.$save();
223
245
 
224
246
  expect(bobsEntity.guid).not.toBeNull();
225
247
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -241,6 +263,103 @@ export function TilmeldTest(
241
263
  expect(testEntityBob?.acFull).toEqual([]);
242
264
  });
243
265
 
266
+ it('require authentication decorator', async () => {
267
+ const { bob } = await makeUsers();
268
+
269
+ await tilmeld.fillSession(bob);
270
+
271
+ const bobsEntity = await TestModel.factory();
272
+ bobsEntity.name = "Bob's Entity";
273
+ await bobsEntity.$save();
274
+
275
+ expect(bobsEntity.$testRequireAuthenticationDecorator()).toEqual(true);
276
+ expect(
277
+ await bobsEntity.$testRequireAuthenticationDecoratorAsync(),
278
+ ).toEqual(true);
279
+
280
+ tilmeld.clearSession();
281
+
282
+ try {
283
+ bobsEntity.$testRequireAuthenticationDecorator();
284
+
285
+ throw new Error('Should have thrown.');
286
+ } catch (e: any) {
287
+ expect(e).toBeInstanceOf(HttpError);
288
+ expect(e.status).toEqual(403);
289
+ expect(e.message).toEqual('Forbidden');
290
+ }
291
+
292
+ try {
293
+ await bobsEntity.$testRequireAuthenticationDecoratorAsync();
294
+
295
+ throw new Error('Should have thrown.');
296
+ } catch (e: any) {
297
+ expect(e).toBeInstanceOf(HttpError);
298
+ expect(e.status).toEqual(403);
299
+ expect(e.message).toEqual('Forbidden');
300
+ }
301
+ });
302
+
303
+ it('require ability decorator', async () => {
304
+ const { bob } = await makeUsers();
305
+
306
+ await tilmeld.fillSession(bob);
307
+
308
+ const bobsEntity = await TestModel.factory();
309
+ bobsEntity.name = "Bob's Entity";
310
+ await bobsEntity.$save();
311
+
312
+ try {
313
+ bobsEntity.$testRequireAbilityDecorator();
314
+
315
+ throw new Error('Should have thrown.');
316
+ } catch (e: any) {
317
+ expect(e).toBeInstanceOf(HttpError);
318
+ expect(e.status).toEqual(403);
319
+ expect(e.message).toEqual('Forbidden');
320
+ }
321
+
322
+ try {
323
+ await bobsEntity.$testRequireAbilityDecoratorAsync();
324
+
325
+ throw new Error('Should have thrown.');
326
+ } catch (e: any) {
327
+ expect(e).toBeInstanceOf(HttpError);
328
+ expect(e.status).toEqual(403);
329
+ expect(e.message).toEqual('Forbidden');
330
+ }
331
+
332
+ tilmeld.clearSession();
333
+
334
+ try {
335
+ bobsEntity.$testRequireAbilityDecorator();
336
+
337
+ throw new Error('Should have thrown.');
338
+ } catch (e: any) {
339
+ expect(e).toBeInstanceOf(HttpError);
340
+ expect(e.status).toEqual(403);
341
+ expect(e.message).toEqual('Forbidden');
342
+ }
343
+
344
+ try {
345
+ await bobsEntity.$testRequireAbilityDecoratorAsync();
346
+
347
+ throw new Error('Should have thrown.');
348
+ } catch (e: any) {
349
+ expect(e).toBeInstanceOf(HttpError);
350
+ expect(e.status).toEqual(403);
351
+ expect(e.message).toEqual('Forbidden');
352
+ }
353
+
354
+ bob.$grant('test-ability');
355
+ await tilmeld.fillSession(bob);
356
+
357
+ expect(bobsEntity.$testRequireAbilityDecorator()).toEqual(true);
358
+ expect(await bobsEntity.$testRequireAbilityDecoratorAsync()).toEqual(
359
+ true,
360
+ );
361
+ });
362
+
244
363
  it("alice can't access an entity owned by bob", async () => {
245
364
  const { bob, alice } = await makeUsers();
246
365
 
@@ -248,7 +367,7 @@ export function TilmeldTest(
248
367
 
249
368
  const bobsEntity = await TestModel.factory();
250
369
  bobsEntity.name = "Bob's Entity";
251
- expect(await bobsEntity.$save()).toEqual(true);
370
+ await bobsEntity.$save();
252
371
 
253
372
  expect(bobsEntity.guid).not.toBeNull();
254
373
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -280,7 +399,7 @@ export function TilmeldTest(
280
399
  const bobsEntity = await TestModel.factory();
281
400
  bobsEntity.name = "Bob's Entity";
282
401
  bobsEntity.acRead = [alice.guid ?? ''];
283
- expect(await bobsEntity.$save()).toEqual(true);
402
+ await bobsEntity.$save();
284
403
 
285
404
  expect(bobsEntity.guid).not.toBeNull();
286
405
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -328,7 +447,7 @@ export function TilmeldTest(
328
447
  const bobsEntity = await TestModel.factory();
329
448
  bobsEntity.name = "Bob's Entity";
330
449
  bobsEntity.acWrite = [alice.guid ?? ''];
331
- expect(await bobsEntity.$save()).toEqual(true);
450
+ await bobsEntity.$save();
332
451
 
333
452
  expect(bobsEntity.guid).not.toBeNull();
334
453
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -357,7 +476,7 @@ export function TilmeldTest(
357
476
  }
358
477
 
359
478
  testEntityAlice.name = "Haha! It's mine now!";
360
- expect(await testEntityAlice.$save()).toEqual(true);
479
+ await testEntityAlice.$save();
361
480
 
362
481
  expect(await testEntityAlice.$refresh()).toEqual(true);
363
482
  expect(testEntityAlice.name).toEqual("Haha! It's mine now!");
@@ -371,7 +490,7 @@ export function TilmeldTest(
371
490
  const bobsEntity = await TestModel.factory();
372
491
  bobsEntity.name = "Bob's Entity";
373
492
  bobsEntity.acWrite = [alice.guid ?? ''];
374
- expect(await bobsEntity.$save()).toEqual(true);
493
+ await bobsEntity.$save();
375
494
 
376
495
  expect(bobsEntity.guid).not.toBeNull();
377
496
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -418,7 +537,7 @@ export function TilmeldTest(
418
537
  const bobsEntity = await TestModel.factory();
419
538
  bobsEntity.name = "Bob's Entity";
420
539
  bobsEntity.acFull = [alice.guid ?? ''];
421
- expect(await bobsEntity.$save()).toEqual(true);
540
+ await bobsEntity.$save();
422
541
 
423
542
  expect(bobsEntity.guid).not.toBeNull();
424
543
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -446,7 +565,7 @@ export function TilmeldTest(
446
565
  throw new Error();
447
566
  }
448
567
 
449
- expect(await testEntityAlice.$delete()).toEqual(true);
568
+ await testEntityAlice.$delete();
450
569
  const verifyEntityAlice = await nymph.getEntity(
451
570
  { class: TestModel },
452
571
  { type: '&', guid: bobsEntity.guid || '' },
@@ -462,7 +581,7 @@ export function TilmeldTest(
462
581
  const bobsEntity = await TestModel.factory();
463
582
  bobsEntity.name = "Bob's Entity";
464
583
  bobsEntity.acRead = [abgroup.guid ?? ''];
465
- expect(await bobsEntity.$save()).toEqual(true);
584
+ await bobsEntity.$save();
466
585
 
467
586
  expect(bobsEntity.guid).not.toBeNull();
468
587
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -495,7 +614,7 @@ export function TilmeldTest(
495
614
  const bobsEntity = await TestModel.factory();
496
615
  bobsEntity.name = "Bob's Entity";
497
616
  bobsEntity.acRead = [abgroup.guid ?? ''];
498
- expect(await bobsEntity.$save()).toEqual(true);
617
+ await bobsEntity.$save();
499
618
 
500
619
  expect(bobsEntity.guid).not.toBeNull();
501
620
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -543,7 +662,7 @@ export function TilmeldTest(
543
662
  const bobsEntity = await TestModel.factory();
544
663
  bobsEntity.name = "Bob's Entity";
545
664
  bobsEntity.acWrite = [abgroup.guid ?? ''];
546
- expect(await bobsEntity.$save()).toEqual(true);
665
+ await bobsEntity.$save();
547
666
 
548
667
  expect(bobsEntity.guid).not.toBeNull();
549
668
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -572,7 +691,7 @@ export function TilmeldTest(
572
691
  }
573
692
 
574
693
  testEntityAlice.name = "Haha! It's mine now!";
575
- expect(await testEntityAlice.$save()).toEqual(true);
694
+ await testEntityAlice.$save();
576
695
 
577
696
  expect(await testEntityAlice.$refresh()).toEqual(true);
578
697
  expect(testEntityAlice.name).toEqual("Haha! It's mine now!");
@@ -586,7 +705,7 @@ export function TilmeldTest(
586
705
  const bobsEntity = await TestModel.factory();
587
706
  bobsEntity.name = "Bob's Entity";
588
707
  bobsEntity.acWrite = [abgroup.guid ?? ''];
589
- expect(await bobsEntity.$save()).toEqual(true);
708
+ await bobsEntity.$save();
590
709
 
591
710
  expect(bobsEntity.guid).not.toBeNull();
592
711
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -633,7 +752,7 @@ export function TilmeldTest(
633
752
  const bobsEntity = await TestModel.factory();
634
753
  bobsEntity.name = "Bob's Entity";
635
754
  bobsEntity.acFull = [abgroup.guid ?? ''];
636
- expect(await bobsEntity.$save()).toEqual(true);
755
+ await bobsEntity.$save();
637
756
 
638
757
  expect(bobsEntity.guid).not.toBeNull();
639
758
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -661,7 +780,7 @@ export function TilmeldTest(
661
780
  throw new Error();
662
781
  }
663
782
 
664
- expect(await testEntityAlice.$delete()).toEqual(true);
783
+ await testEntityAlice.$delete();
665
784
  const verifyEntityAlice = await nymph.getEntity(
666
785
  { class: TestModel },
667
786
  { type: '&', guid: bobsEntity.guid || '' },
@@ -677,7 +796,7 @@ export function TilmeldTest(
677
796
  const bobsEntity = await TestModel.factory();
678
797
  bobsEntity.name = "Bob's Entity";
679
798
  bobsEntity.group = alice.group;
680
- expect(await bobsEntity.$save()).toEqual(true);
799
+ await bobsEntity.$save();
681
800
 
682
801
  expect(bobsEntity.guid).not.toBeNull();
683
802
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -710,7 +829,7 @@ export function TilmeldTest(
710
829
  const bobsEntity = await TestModel.factory();
711
830
  bobsEntity.name = "Bob's Entity";
712
831
  bobsEntity.group = alice.group;
713
- expect(await bobsEntity.$save()).toEqual(true);
832
+ await bobsEntity.$save();
714
833
 
715
834
  expect(bobsEntity.guid).not.toBeNull();
716
835
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -759,7 +878,7 @@ export function TilmeldTest(
759
878
  bobsEntity.name = "Bob's Entity";
760
879
  bobsEntity.group = alice.group;
761
880
  bobsEntity.acGroup = TilmeldAccessLevels.WRITE_ACCESS;
762
- expect(await bobsEntity.$save()).toEqual(true);
881
+ await bobsEntity.$save();
763
882
 
764
883
  expect(bobsEntity.guid).not.toBeNull();
765
884
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -788,7 +907,7 @@ export function TilmeldTest(
788
907
  }
789
908
 
790
909
  testEntityAlice.name = "Haha! It's mine now!";
791
- expect(await testEntityAlice.$save()).toEqual(true);
910
+ await testEntityAlice.$save();
792
911
 
793
912
  expect(await testEntityAlice.$refresh()).toEqual(true);
794
913
  expect(testEntityAlice.name).toEqual("Haha! It's mine now!");
@@ -803,7 +922,7 @@ export function TilmeldTest(
803
922
  bobsEntity.name = "Bob's Entity";
804
923
  bobsEntity.group = alice.group;
805
924
  bobsEntity.acGroup = TilmeldAccessLevels.WRITE_ACCESS;
806
- expect(await bobsEntity.$save()).toEqual(true);
925
+ await bobsEntity.$save();
807
926
 
808
927
  expect(bobsEntity.guid).not.toBeNull();
809
928
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -851,7 +970,7 @@ export function TilmeldTest(
851
970
  bobsEntity.name = "Bob's Entity";
852
971
  bobsEntity.group = alice.group;
853
972
  bobsEntity.acGroup = TilmeldAccessLevels.FULL_ACCESS;
854
- expect(await bobsEntity.$save()).toEqual(true);
973
+ await bobsEntity.$save();
855
974
 
856
975
  expect(bobsEntity.guid).not.toBeNull();
857
976
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -879,7 +998,7 @@ export function TilmeldTest(
879
998
  throw new Error();
880
999
  }
881
1000
 
882
- expect(await testEntityAlice.$delete()).toEqual(true);
1001
+ await testEntityAlice.$delete();
883
1002
  const verifyEntityAlice = await nymph.getEntity(
884
1003
  { class: TestModel },
885
1004
  { type: '&', guid: bobsEntity.guid || '' },
@@ -895,7 +1014,7 @@ export function TilmeldTest(
895
1014
  const bobsEntity = await TestModel.factory();
896
1015
  bobsEntity.name = "Bob's Entity";
897
1016
  bobsEntity.acOther = TilmeldAccessLevels.READ_ACCESS;
898
- expect(await bobsEntity.$save()).toEqual(true);
1017
+ await bobsEntity.$save();
899
1018
 
900
1019
  expect(bobsEntity.guid).not.toBeNull();
901
1020
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -928,7 +1047,7 @@ export function TilmeldTest(
928
1047
  const bobsEntity = await TestModel.factory();
929
1048
  bobsEntity.name = "Bob's Entity";
930
1049
  bobsEntity.acOther = TilmeldAccessLevels.READ_ACCESS;
931
- expect(await bobsEntity.$save()).toEqual(true);
1050
+ await bobsEntity.$save();
932
1051
 
933
1052
  expect(bobsEntity.guid).not.toBeNull();
934
1053
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -976,7 +1095,7 @@ export function TilmeldTest(
976
1095
  const bobsEntity = await TestModel.factory();
977
1096
  bobsEntity.name = "Bob's Entity";
978
1097
  bobsEntity.acOther = TilmeldAccessLevels.WRITE_ACCESS;
979
- expect(await bobsEntity.$save()).toEqual(true);
1098
+ await bobsEntity.$save();
980
1099
 
981
1100
  expect(bobsEntity.guid).not.toBeNull();
982
1101
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1005,7 +1124,7 @@ export function TilmeldTest(
1005
1124
  }
1006
1125
 
1007
1126
  testEntityAlice.name = "Haha! It's mine now!";
1008
- expect(await testEntityAlice.$save()).toEqual(true);
1127
+ await testEntityAlice.$save();
1009
1128
 
1010
1129
  expect(await testEntityAlice.$refresh()).toEqual(true);
1011
1130
  expect(testEntityAlice.name).toEqual("Haha! It's mine now!");
@@ -1019,7 +1138,7 @@ export function TilmeldTest(
1019
1138
  const bobsEntity = await TestModel.factory();
1020
1139
  bobsEntity.name = "Bob's Entity";
1021
1140
  bobsEntity.acOther = TilmeldAccessLevels.WRITE_ACCESS;
1022
- expect(await bobsEntity.$save()).toEqual(true);
1141
+ await bobsEntity.$save();
1023
1142
 
1024
1143
  expect(bobsEntity.guid).not.toBeNull();
1025
1144
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1066,7 +1185,7 @@ export function TilmeldTest(
1066
1185
  const bobsEntity = await TestModel.factory();
1067
1186
  bobsEntity.name = "Bob's Entity";
1068
1187
  bobsEntity.acOther = TilmeldAccessLevels.FULL_ACCESS;
1069
- expect(await bobsEntity.$save()).toEqual(true);
1188
+ await bobsEntity.$save();
1070
1189
 
1071
1190
  expect(bobsEntity.guid).not.toBeNull();
1072
1191
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1094,7 +1213,7 @@ export function TilmeldTest(
1094
1213
  throw new Error();
1095
1214
  }
1096
1215
 
1097
- expect(await testEntityAlice.$delete()).toEqual(true);
1216
+ await testEntityAlice.$delete();
1098
1217
  const verifyEntityAlice = await nymph.getEntity(
1099
1218
  { class: TestModel },
1100
1219
  { type: '&', guid: bobsEntity.guid || '' },
@@ -1110,7 +1229,7 @@ export function TilmeldTest(
1110
1229
  const bobsEntity = await TestModel.factory();
1111
1230
  bobsEntity.name = "Bob's Entity";
1112
1231
  bobsEntity.acOther = TilmeldAccessLevels.FULL_ACCESS;
1113
- expect(await bobsEntity.$save()).toEqual(true);
1232
+ await bobsEntity.$save();
1114
1233
 
1115
1234
  expect(bobsEntity.guid).not.toBeNull();
1116
1235
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1137,7 +1256,7 @@ export function TilmeldTest(
1137
1256
  throw new Error();
1138
1257
  }
1139
1258
 
1140
- expect(await testEntityNobody.$delete()).toEqual(true);
1259
+ await testEntityNobody.$delete();
1141
1260
  const verifyEntityNobody = await nymph.getEntity(
1142
1261
  { class: TestModel },
1143
1262
  { type: '&', guid: bobsEntity.guid || '' },
@@ -1152,7 +1271,7 @@ export function TilmeldTest(
1152
1271
  ...(await nymph.getEntities({ class: Group, skipAc: true })),
1153
1272
  ];
1154
1273
  for (let entity of allEntities) {
1155
- expect(await entity.$deleteSkipAC()).toEqual(true);
1274
+ await entity.$deleteSkipAC();
1156
1275
  }
1157
1276
  });
1158
1277
 
@@ -1170,7 +1289,7 @@ export function TilmeldTest(
1170
1289
  ];
1171
1290
  bobsEntity.acWrite = [alice.guid ?? '', bob.guid ?? ''];
1172
1291
  bobsEntity.acFull = [bob.guid ?? ''];
1173
- expect(await bobsEntity.$save()).toEqual(true);
1292
+ await bobsEntity.$save();
1174
1293
 
1175
1294
  expect(bobsEntity.guid).not.toBeNull();
1176
1295
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1542,7 +1661,7 @@ export function TilmeldTest(
1542
1661
 
1543
1662
  const alicesEntity = await TestModel.factory();
1544
1663
  alicesEntity.name = "Alice's Entity";
1545
- expect(await alicesEntity.$save()).toEqual(true);
1664
+ await alicesEntity.$save();
1546
1665
 
1547
1666
  expect(alicesEntity.guid).not.toBeNull();
1548
1667
  expect(alice.$is(alicesEntity.user)).toEqual(true);
@@ -1566,7 +1685,7 @@ export function TilmeldTest(
1566
1685
  const bobsEntity = await TestModel.factory();
1567
1686
  bobsEntity.name = "Bob's Entity";
1568
1687
  bobsEntity.group = alice.group;
1569
- expect(await bobsEntity.$save()).toEqual(true);
1688
+ await bobsEntity.$save();
1570
1689
 
1571
1690
  expect(bobsEntity.guid).not.toBeNull();
1572
1691
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1615,7 +1734,7 @@ export function TilmeldTest(
1615
1734
  const bobsEntity = await TestModel.factory();
1616
1735
  bobsEntity.name = "Bob's Entity";
1617
1736
  bobsEntity.acOther = TilmeldAccessLevels.READ_ACCESS;
1618
- expect(await bobsEntity.$save()).toEqual(true);
1737
+ await bobsEntity.$save();
1619
1738
 
1620
1739
  expect(bobsEntity.guid).not.toBeNull();
1621
1740
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1661,7 +1780,7 @@ export function TilmeldTest(
1661
1780
  const bobsEntity = await TestModel.factory();
1662
1781
  bobsEntity.name = "Bob's Entity";
1663
1782
  bobsEntity.acRead = [alice.guid ?? ''];
1664
- expect(await bobsEntity.$save()).toEqual(true);
1783
+ await bobsEntity.$save();
1665
1784
 
1666
1785
  expect(bobsEntity.guid).not.toBeNull();
1667
1786
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1707,7 +1826,7 @@ export function TilmeldTest(
1707
1826
  const bobsEntity = await TestModel.factory();
1708
1827
  bobsEntity.name = "Bob's Entity";
1709
1828
  bobsEntity.acWrite = [alice.group?.guid ?? ''];
1710
- expect(await bobsEntity.$save()).toEqual(true);
1829
+ await bobsEntity.$save();
1711
1830
 
1712
1831
  expect(bobsEntity.guid).not.toBeNull();
1713
1832
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1756,7 +1875,7 @@ export function TilmeldTest(
1756
1875
  const bobsEntity = await TestModel.factory();
1757
1876
  bobsEntity.name = "Bob's Entity";
1758
1877
  bobsEntity.group = abgroup;
1759
- expect(await bobsEntity.$save()).toEqual(true);
1878
+ await bobsEntity.$save();
1760
1879
 
1761
1880
  expect(bobsEntity.guid).not.toBeNull();
1762
1881
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1805,7 +1924,7 @@ export function TilmeldTest(
1805
1924
  const bobsEntity = await TestModel.factory();
1806
1925
  bobsEntity.name = "Bob's Entity";
1807
1926
  bobsEntity.acFull = [abgroup.guid ?? ''];
1808
- expect(await bobsEntity.$save()).toEqual(true);
1927
+ await bobsEntity.$save();
1809
1928
 
1810
1929
  expect(bobsEntity.guid).not.toBeNull();
1811
1930
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1867,7 +1986,7 @@ export function TilmeldTest(
1867
1986
  const bobsEntity = await TestModel.factory();
1868
1987
  bobsEntity.name = "Bob's Entity";
1869
1988
  bobsEntity.acFull = [alice.guid ?? ''];
1870
- expect(await bobsEntity.$save()).toEqual(true);
1989
+ await bobsEntity.$save();
1871
1990
 
1872
1991
  expect(bobsEntity.guid).not.toBeNull();
1873
1992
  expect(bob.$is(bobsEntity.user)).toEqual(true);
@@ -1885,7 +2004,7 @@ export function TilmeldTest(
1885
2004
 
1886
2005
  const alicesEntity = await TestModel.factory();
1887
2006
  alicesEntity.name = "Alice's Entity";
1888
- expect(await alicesEntity.$save()).toEqual(true);
2007
+ await alicesEntity.$save();
1889
2008
 
1890
2009
  expect(alicesEntity.guid).not.toBeNull();
1891
2010
  expect(alice.$is(alicesEntity.user)).toEqual(true);
@@ -1941,7 +2060,7 @@ export function TilmeldTest(
1941
2060
 
1942
2061
  const bobsEntity = await TestModel.factory();
1943
2062
  bobsEntity.name = "Bob's Entity";
1944
- expect(await bobsEntity.$save()).toEqual(true);
2063
+ await bobsEntity.$save();
1945
2064
 
1946
2065
  expect(bobsEntity.guid).not.toBeNull();
1947
2066
  expect(bob.$is(bobsEntity.user)).toEqual(true);