@@ -24,7 +24,7 @@ describe("test rumble abilities", async () => {
2424 const r = await executor ( {
2525 document : parse ( /* GraphQL */ `
2626 query {
27- findFirstUsers {
27+ user(id: "3e0bb3d0-2074-4a1e-6263-d13dd10cb0cf") {
2828 id
2929 firstName
3030 }
@@ -34,7 +34,7 @@ describe("test rumble abilities", async () => {
3434
3535 expect ( r ) . toEqual ( {
3636 data : {
37- findFirstUsers : {
37+ user : {
3838 id : data . users [ 0 ] . id ,
3939 firstName : data . users [ 0 ] . firstName ,
4040 } ,
@@ -47,15 +47,15 @@ describe("test rumble abilities", async () => {
4747 const r = await executor ( {
4848 document : parse ( /* GraphQL */ `
4949 query {
50- findFirstPosts {
50+ post(id: "ee25b2d9-72ce-4839-3c39-c9de183c81ec") {
5151 id
5252 }
5353 }
5454 ` ) ,
5555 } ) ;
5656
5757 expect ( ( r as any ) . errors . length ) . toEqual ( 1 ) ;
58- expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "findFirstPosts " ] ) ;
58+ expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "post " ] ) ;
5959 } ) ;
6060
6161 test ( "omit indirect read with helper implementation" , async ( ) => {
@@ -65,7 +65,7 @@ describe("test rumble abilities", async () => {
6565 const r = await executor ( {
6666 document : parse ( /* GraphQL */ `
6767 query {
68- findManyUsers {
68+ users {
6969 id
7070 firstName
7171 posts {
@@ -77,11 +77,10 @@ describe("test rumble abilities", async () => {
7777 } ) ;
7878
7979 // all users should be readable
80- expect ( ( r as any ) . data . findManyUsers . length ) . toEqual ( 9 ) ;
80+ expect ( ( r as any ) . data . users . length ) . toEqual ( 9 ) ;
8181 // no user should have any posts returned
8282 expect (
83- ( r as any ) . data . findManyUsers . filter ( ( u : any ) => u . posts . length > 0 )
84- . length ,
83+ ( r as any ) . data . users . filter ( ( u : any ) => u . posts . length > 0 ) . length ,
8584 ) . toEqual ( 0 ) ;
8685 } ) ;
8786
@@ -93,7 +92,7 @@ describe("test rumble abilities", async () => {
9392 const r = await executor ( {
9493 document : parse ( /* GraphQL */ `
9594 query {
96- findManyUsers {
95+ users {
9796 id
9897 firstName
9998 posts {
@@ -104,10 +103,9 @@ describe("test rumble abilities", async () => {
104103 ` ) ,
105104 } ) ;
106105
107- expect ( ( r as any ) . data . findManyUsers . length ) . toEqual ( 9 ) ;
106+ expect ( ( r as any ) . data . users . length ) . toEqual ( 9 ) ;
108107 expect (
109- ( r as any ) . data . findManyUsers . filter ( ( u : any ) => u . posts . length === 1 )
110- . length ,
108+ ( r as any ) . data . users . filter ( ( u : any ) => u . posts . length === 1 ) . length ,
111109 ) . toEqual ( 2 ) ;
112110 } ) ;
113111
@@ -118,7 +116,7 @@ describe("test rumble abilities", async () => {
118116 const r = await executor ( {
119117 document : parse ( /* GraphQL */ `
120118 query {
121- findManyComments {
119+ comments {
122120 id
123121 author {
124122 id
@@ -129,11 +127,7 @@ describe("test rumble abilities", async () => {
129127 } ) ;
130128
131129 expect ( ( r as any ) . errors . length ) . toEqual ( 1 ) ;
132- expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [
133- "findManyComments" ,
134- 0 ,
135- "author" ,
136- ] ) ;
130+ expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "comments" , 0 , "author" ] ) ;
137131 } ) ;
138132
139133 test ( "deny indirect read with helper implementation on one to one with error on nullable relationship" , async ( ) => {
@@ -143,7 +137,7 @@ describe("test rumble abilities", async () => {
143137 const r = await executor ( {
144138 document : parse ( /* GraphQL */ `
145139 query {
146- findManyComments {
140+ comments {
147141 id
148142 post {
149143 id
@@ -154,11 +148,7 @@ describe("test rumble abilities", async () => {
154148 } ) ;
155149
156150 expect ( ( r as any ) . errors . length ) . toEqual ( 1 ) ;
157- expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [
158- "findManyComments" ,
159- 0 ,
160- "post" ,
161- ] ) ;
151+ expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "comments" , 0 , "post" ] ) ;
162152 } ) ;
163153
164154 test ( "allow indirect read with helper implementation on one to one" , async ( ) => {
@@ -169,7 +159,7 @@ describe("test rumble abilities", async () => {
169159 const r = await executor ( {
170160 document : parse ( /* GraphQL */ `
171161 query {
172- findManyComments {
162+ comments {
173163 id
174164 author {
175165 id
@@ -179,9 +169,9 @@ describe("test rumble abilities", async () => {
179169 ` ) ,
180170 } ) ;
181171
182- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 9 ) ;
172+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 9 ) ;
183173 expect (
184- ( r as any ) . data . findManyComments . filter ( ( u : any ) => u . author ) . length ,
174+ ( r as any ) . data . comments . filter ( ( u : any ) => u . author ) . length ,
185175 ) . toEqual ( 9 ) ;
186176 } ) ;
187177
@@ -196,14 +186,14 @@ describe("test rumble abilities", async () => {
196186 const r = await executor ( {
197187 document : parse ( /* GraphQL */ `
198188 query {
199- findManyComments {
189+ comments {
200190 id
201191 }
202192 }
203193 ` ) ,
204194 } ) ;
205195
206- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 9 ) ;
196+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 9 ) ;
207197 } ) ;
208198
209199 test ( "deny with dynamic specific condition" , async ( ) => {
@@ -222,14 +212,14 @@ describe("test rumble abilities", async () => {
222212 const r = await executor ( {
223213 document : parse ( /* GraphQL */ `
224214 query {
225- findManyComments {
215+ comments {
226216 id
227217 }
228218 }
229219 ` ) ,
230220 } ) ;
231221
232- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 0 ) ;
222+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 0 ) ;
233223 } ) ;
234224
235225 test ( "deny read with dynamic specific condition AND static condition with diverging permissions" , async ( ) => {
@@ -242,14 +232,14 @@ describe("test rumble abilities", async () => {
242232 const r = await executor ( {
243233 document : parse ( /* GraphQL */ `
244234 query {
245- findManyComments {
235+ comments {
246236 id
247237 }
248238 }
249239 ` ) ,
250240 } ) ;
251241
252- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 0 ) ;
242+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 0 ) ;
253243 } ) ;
254244
255245 test ( "allow read with dynamic specific wildcard condition" , async ( ) => {
@@ -261,14 +251,14 @@ describe("test rumble abilities", async () => {
261251 const r = await executor ( {
262252 document : parse ( /* GraphQL */ `
263253 query {
264- findManyComments {
254+ comments {
265255 id
266256 }
267257 }
268258 ` ) ,
269259 } ) ;
270260
271- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 9 ) ;
261+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 9 ) ;
272262 } ) ;
273263
274264 test ( "allow read only with specific condition based on request context" , async ( ) => {
@@ -280,14 +270,14 @@ describe("test rumble abilities", async () => {
280270 const r = await executor ( {
281271 document : parse ( /* GraphQL */ `
282272 query {
283- findManyComments {
273+ comments {
284274 id
285275 }
286276 }
287277 ` ) ,
288278 } ) ;
289279
290- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 2 ) ;
280+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 2 ) ;
291281 } ) ;
292282
293283 test ( "limit read amount with abilities" , async ( ) => {
@@ -299,14 +289,14 @@ describe("test rumble abilities", async () => {
299289 const r = await executor ( {
300290 document : parse ( /* GraphQL */ `
301291 query {
302- findManyComments {
292+ comments {
303293 id
304294 }
305295 }
306296 ` ) ,
307297 } ) ;
308298
309- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 3 ) ;
299+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 3 ) ;
310300 } ) ;
311301
312302 test ( "limit read amount to max value with abilities" , async ( ) => {
@@ -322,14 +312,14 @@ describe("test rumble abilities", async () => {
322312 const r = await executor ( {
323313 document : parse ( /* GraphQL */ `
324314 query {
325- findManyComments {
315+ comments {
326316 id
327317 }
328318 }
329319 ` ) ,
330320 } ) ;
331321
332- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 4 ) ;
322+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 4 ) ;
333323 } ) ;
334324
335325 test ( "error simple read with helper implementation with column restrictions" , async ( ) => {
@@ -345,7 +335,7 @@ describe("test rumble abilities", async () => {
345335 const r = await executor ( {
346336 document : parse ( /* GraphQL */ `
347337 query {
348- findFirstUsers {
338+ user(id: "3e0bb3d0-2074-4a1e-6263-d13dd10cb0cf") {
349339 id
350340 firstName
351341 email
@@ -355,7 +345,7 @@ describe("test rumble abilities", async () => {
355345 } ) ;
356346
357347 expect ( ( r as any ) . errors . length ) . toEqual ( 1 ) ;
358- expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "findFirstUsers " , "id" ] ) ;
348+ expect ( ( r as any ) . errors . at ( 0 ) . path ) . toEqual ( [ "user " , "id" ] ) ;
359349 } ) ;
360350
361351 test ( "deny read with stacked wildcard permission" , async ( ) => {
@@ -372,14 +362,14 @@ describe("test rumble abilities", async () => {
372362 const r = await executor ( {
373363 document : parse ( /* GraphQL */ `
374364 query {
375- findManyComments {
365+ comments {
376366 id
377367 }
378368 }
379369 ` ) ,
380370 } ) ;
381371
382- expect ( ( r as any ) . data . findManyComments . length ) . toEqual ( 0 ) ;
372+ expect ( ( r as any ) . data . comments . length ) . toEqual ( 0 ) ;
383373 } ) ;
384374
385375 //TODO
0 commit comments