@@ -79,6 +79,12 @@ const teacher = {
79
79
fetch : jest . fn ( ) ,
80
80
remove : jest . fn ( ( role ) => teacher . roles . cache = teacher . roles . cache . filter ( r => r . name !== role . name ) ) ,
81
81
} ,
82
+ permissions : {
83
+ list : [ ] ,
84
+ has ( perm ) {
85
+ return this . list . includes ( perm ) ;
86
+ } ,
87
+ } ,
82
88
_roles : [ 1 , 3 , 4 ] ,
83
89
fetch : jest . fn ( ) ,
84
90
displayName : "teacher" ,
@@ -97,6 +103,12 @@ const student = {
97
103
fetch : jest . fn ( ) ,
98
104
remove : jest . fn ( ( role ) => student . roles . cache = student . roles . cache . filter ( r => r . name !== role . name ) ) ,
99
105
} ,
106
+ permissions : {
107
+ list : [ ] ,
108
+ has ( perm ) {
109
+ return this . list . includes ( perm ) ;
110
+ } ,
111
+ } ,
100
112
_roles : [ 3 ] ,
101
113
fetch : jest . fn ( ) ,
102
114
displayName : "student" ,
@@ -115,6 +127,12 @@ const admin = {
115
127
fetch : jest . fn ( ) ,
116
128
remove : jest . fn ( ( role ) => admin . roles . cache = admin . roles . cache . filter ( r => r . name !== role . name ) ) ,
117
129
} ,
130
+ permissions : {
131
+ list : [ "ADMINISTRATOR" ] ,
132
+ has ( perm ) {
133
+ return this . list . includes ( perm ) ;
134
+ } ,
135
+ } ,
118
136
_roles : [ 2 , 3 ] ,
119
137
fetch : jest . fn ( ) ,
120
138
displayName : "admin" ,
@@ -198,6 +216,15 @@ const defaultTeacherInteraction = {
198
216
member : {
199
217
user : teacher ,
200
218
_roles : [ 1 , 3 , 4 ] ,
219
+ roles : {
220
+ cache : teacher . roles . cache ,
221
+ } ,
222
+ permissions : {
223
+ list : [ ] ,
224
+ has ( perm ) {
225
+ return this . list . includes ( perm ) ;
226
+ } ,
227
+ } ,
201
228
} ,
202
229
options : undefined ,
203
230
reply : jest . fn ( ) ,
@@ -209,6 +236,15 @@ const defaultStudentInteraction = {
209
236
member : {
210
237
user : student ,
211
238
_roles : [ 1 ] ,
239
+ roles : {
240
+ cache : student . roles . cache ,
241
+ } ,
242
+ permissions : {
243
+ list : [ ] ,
244
+ has ( perm ) {
245
+ return this . list . includes ( perm ) ;
246
+ } ,
247
+ } ,
212
248
} ,
213
249
options : undefined ,
214
250
reply : jest . fn ( ) ,
@@ -221,6 +257,12 @@ const studentInteractionWithoutOptions = {
221
257
user : {
222
258
id : 2 ,
223
259
} ,
260
+ permissions : {
261
+ list : [ ] ,
262
+ has ( perm ) {
263
+ return this . list . includes ( perm ) ;
264
+ } ,
265
+ } ,
224
266
} ,
225
267
options : undefined ,
226
268
} ;
@@ -231,7 +273,15 @@ const defaultAdminInteraction = {
231
273
member : {
232
274
user : admin ,
233
275
_roles : [ 2 , 3 ] ,
234
- roles : [ 2 , 3 ] ,
276
+ roles : {
277
+ cache : admin . roles . cache ,
278
+ } ,
279
+ permissions : {
280
+ list : [ "ADMINISTRATOR" ] ,
281
+ has ( perm ) {
282
+ return this . list . includes ( perm ) ;
283
+ } ,
284
+ } ,
235
285
} ,
236
286
options : undefined ,
237
287
commandName : "test" ,
0 commit comments