@@ -69,16 +69,16 @@ describe('DatabaseController', function () {
69
69
'getExpectedType' ,
70
70
] ) ;
71
71
72
- it ( 'should not decorate query if no pointer CLPs are present' , done => {
72
+ it ( 'should not decorate query if no pointer CLPs are present' , async done => {
73
73
const clp = buildCLP ( ) ;
74
74
const query = { a : 'b' } ;
75
75
76
76
schemaController . testPermissionsForClassName
77
77
. withArgs ( CLASS_NAME , ACL_GROUP , OPERATION )
78
78
. and . returnValue ( true ) ;
79
- schemaController . getClassLevelPermissions . withArgs ( CLASS_NAME ) . and . returnValue ( clp ) ;
79
+ await schemaController . getClassLevelPermissions . withArgs ( CLASS_NAME ) . and . returnValue ( clp ) ;
80
80
81
- const output = databaseController . addPointerPermissions (
81
+ const output = await databaseController . addPointerPermissions (
82
82
schemaController ,
83
83
CLASS_NAME ,
84
84
OPERATION ,
@@ -91,7 +91,7 @@ describe('DatabaseController', function () {
91
91
done ( ) ;
92
92
} ) ;
93
93
94
- it ( 'should decorate query if a pointer CLP entry is present' , done => {
94
+ it ( 'should decorate query if a pointer CLP entry is present' , async done => {
95
95
const clp = buildCLP ( [ 'user' ] ) ;
96
96
const query = { a : 'b' } ;
97
97
@@ -103,7 +103,7 @@ describe('DatabaseController', function () {
103
103
. withArgs ( CLASS_NAME , 'user' )
104
104
. and . returnValue ( { type : 'Pointer' } ) ;
105
105
106
- const output = databaseController . addPointerPermissions (
106
+ const output = await databaseController . addPointerPermissions (
107
107
schemaController ,
108
108
CLASS_NAME ,
109
109
OPERATION ,
@@ -116,7 +116,7 @@ describe('DatabaseController', function () {
116
116
done ( ) ;
117
117
} ) ;
118
118
119
- it ( 'should decorate query if an array CLP entry is present' , done => {
119
+ it ( 'should decorate query if an array CLP entry is present' , async done => {
120
120
const clp = buildCLP ( [ 'users' ] ) ;
121
121
const query = { a : 'b' } ;
122
122
@@ -128,7 +128,7 @@ describe('DatabaseController', function () {
128
128
. withArgs ( CLASS_NAME , 'users' )
129
129
. and . returnValue ( { type : 'Array' } ) ;
130
130
131
- const output = databaseController . addPointerPermissions (
131
+ const output = await databaseController . addPointerPermissions (
132
132
schemaController ,
133
133
CLASS_NAME ,
134
134
OPERATION ,
@@ -144,7 +144,7 @@ describe('DatabaseController', function () {
144
144
done ( ) ;
145
145
} ) ;
146
146
147
- it ( 'should decorate query if an object CLP entry is present' , done => {
147
+ it ( 'should decorate query if an object CLP entry is present' , async done => {
148
148
const clp = buildCLP ( [ 'user' ] ) ;
149
149
const query = { a : 'b' } ;
150
150
@@ -156,7 +156,7 @@ describe('DatabaseController', function () {
156
156
. withArgs ( CLASS_NAME , 'user' )
157
157
. and . returnValue ( { type : 'Object' } ) ;
158
158
159
- const output = databaseController . addPointerPermissions (
159
+ const output = await databaseController . addPointerPermissions (
160
160
schemaController ,
161
161
CLASS_NAME ,
162
162
OPERATION ,
@@ -172,7 +172,7 @@ describe('DatabaseController', function () {
172
172
done ( ) ;
173
173
} ) ;
174
174
175
- it ( 'should decorate query if a pointer CLP is present and the same field is part of the query' , done => {
175
+ it ( 'should decorate query if a pointer CLP is present and the same field is part of the query' , async done => {
176
176
const clp = buildCLP ( [ 'user' ] ) ;
177
177
const query = { a : 'b' , user : 'a' } ;
178
178
@@ -184,7 +184,7 @@ describe('DatabaseController', function () {
184
184
. withArgs ( CLASS_NAME , 'user' )
185
185
. and . returnValue ( { type : 'Pointer' } ) ;
186
186
187
- const output = databaseController . addPointerPermissions (
187
+ const output = await databaseController . addPointerPermissions (
188
188
schemaController ,
189
189
CLASS_NAME ,
190
190
OPERATION ,
@@ -199,7 +199,7 @@ describe('DatabaseController', function () {
199
199
done ( ) ;
200
200
} ) ;
201
201
202
- it ( 'should transform the query to an $or query if multiple array/pointer CLPs are present' , done => {
202
+ it ( 'should transform the query to an $or query if multiple array/pointer CLPs are present' , async done => {
203
203
const clp = buildCLP ( [ 'user' , 'users' , 'userObject' ] ) ;
204
204
const query = { a : 'b' } ;
205
205
@@ -217,7 +217,7 @@ describe('DatabaseController', function () {
217
217
. withArgs ( CLASS_NAME , 'userObject' )
218
218
. and . returnValue ( { type : 'Object' } ) ;
219
219
220
- const output = databaseController . addPointerPermissions (
220
+ const output = await databaseController . addPointerPermissions (
221
221
schemaController ,
222
222
CLASS_NAME ,
223
223
OPERATION ,
@@ -236,7 +236,7 @@ describe('DatabaseController', function () {
236
236
done ( ) ;
237
237
} ) ;
238
238
239
- it ( 'should not return a $or operation if the query involves one of the two fields also used as array/pointer permissions' , done => {
239
+ it ( 'should not return a $or operation if the query involves one of the two fields also used as array/pointer permissions' , async done => {
240
240
const clp = buildCLP ( [ 'users' , 'user' ] ) ;
241
241
const query = { a : 'b' , user : createUserPointer ( USER_ID ) } ;
242
242
schemaController . testPermissionsForClassName
@@ -249,7 +249,7 @@ describe('DatabaseController', function () {
249
249
schemaController . getExpectedType
250
250
. withArgs ( CLASS_NAME , 'users' )
251
251
. and . returnValue ( { type : 'Array' } ) ;
252
- const output = databaseController . addPointerPermissions (
252
+ const output = await databaseController . addPointerPermissions (
253
253
schemaController ,
254
254
CLASS_NAME ,
255
255
OPERATION ,
@@ -260,7 +260,7 @@ describe('DatabaseController', function () {
260
260
done ( ) ;
261
261
} ) ;
262
262
263
- it ( 'should not return a $or operation if the query involves one of the fields also used as array/pointer permissions' , done => {
263
+ it ( 'should not return a $or operation if the query involves one of the fields also used as array/pointer permissions' , async done => {
264
264
const clp = buildCLP ( [ 'user' , 'users' , 'userObject' ] ) ;
265
265
const query = { a : 'b' , user : createUserPointer ( USER_ID ) } ;
266
266
schemaController . testPermissionsForClassName
@@ -276,7 +276,7 @@ describe('DatabaseController', function () {
276
276
schemaController . getExpectedType
277
277
. withArgs ( CLASS_NAME , 'userObject' )
278
278
. and . returnValue ( { type : 'Object' } ) ;
279
- const output = databaseController . addPointerPermissions (
279
+ const output = await databaseController . addPointerPermissions (
280
280
schemaController ,
281
281
CLASS_NAME ,
282
282
OPERATION ,
@@ -287,7 +287,7 @@ describe('DatabaseController', function () {
287
287
done ( ) ;
288
288
} ) ;
289
289
290
- it ( 'should throw an error if for some unexpected reason the property specified in the CLP is neither a pointer nor an array' , done => {
290
+ it ( 'should throw an error if for some unexpected reason the property specified in the CLP is neither a pointer nor an array' , async done => {
291
291
const clp = buildCLP ( [ 'user' ] ) ;
292
292
const query = { a : 'b' } ;
293
293
@@ -299,15 +299,15 @@ describe('DatabaseController', function () {
299
299
. withArgs ( CLASS_NAME , 'user' )
300
300
. and . returnValue ( { type : 'Number' } ) ;
301
301
302
- expect ( ( ) => {
302
+ await expectAsync (
303
303
databaseController . addPointerPermissions (
304
304
schemaController ,
305
305
CLASS_NAME ,
306
306
OPERATION ,
307
307
query ,
308
308
ACL_GROUP
309
- ) ;
310
- } ) . toThrow (
309
+ )
310
+ ) . toBeRejectedWith (
311
311
Error (
312
312
`An unexpected condition occurred when resolving pointer permissions: ${ CLASS_NAME } user`
313
313
)
0 commit comments