@@ -65,7 +65,12 @@ describe("data", () => {
6565
6666 it ( "creates a new thing object with an explicit id" , ( ) => {
6767 const properties = { stringProp : "with-id" } ;
68- const id = "1565c06c-463f-466c-9092-5930dbac3887" ;
68+ // explicitly make this an all-zero UUID. This way we can be sure that it's
69+ // the first to come up when using the cursor API. Since this test suite
70+ // also contains dynamicaly generated IDs, this is the only way to make
71+ // sure that this ID is first. This way the tests returning objects after
72+ // this ID won't be flaky.
73+ const id = "00000000-0000-0000-0000-000000000000" ;
6974
7075 return client . data
7176 . creator ( )
@@ -128,7 +133,7 @@ describe("data", () => {
128133 expect ( res . objects ) . toEqual (
129134 expect . arrayContaining ( [
130135 expect . objectContaining ( {
131- id : "1565c06c-463f-466c-9092-5930dbac3887 " ,
136+ id : "00000000-0000-0000-0000-000000000000 " ,
132137 properties : { stringProp : "with-id" } ,
133138 } ) ,
134139 expect . objectContaining ( {
@@ -150,7 +155,7 @@ describe("data", () => {
150155 expect ( res . objects ) . toEqual (
151156 expect . arrayContaining ( [
152157 expect . objectContaining ( {
153- id : "1565c06c-463f-466c-9092-5930dbac3887 " ,
158+ id : "00000000-0000-0000-0000-000000000000 " ,
154159 properties : { stringProp : "with-id" } ,
155160 } ) ,
156161 expect . objectContaining ( {
@@ -162,6 +167,26 @@ describe("data", () => {
162167 . catch ( ( e ) => fail ( "it should not have errord: " + e ) ) ;
163168 } ) ;
164169
170+ it ( "gets all classes after a specfic object (Cursor API)" , ( ) => {
171+ return client . data
172+ . getter ( )
173+ . withClassName ( thingClassName )
174+ . withLimit ( 100 )
175+ . withAfter ( "00000000-0000-0000-0000-000000000000" )
176+ . do ( )
177+ . then ( ( res ) => {
178+ expect ( res . objects ) . toHaveLength ( 1 ) ;
179+ expect ( res . objects ) . toEqual (
180+ expect . arrayContaining ( [
181+ expect . objectContaining ( {
182+ properties : { stringProp : "without-id" } ,
183+ } ) ,
184+ ] )
185+ ) ;
186+ } )
187+ . catch ( ( e ) => fail ( "it should not have errord: " + e ) ) ;
188+ } ) ;
189+
165190 it ( "gets all things with all optional _additional params" , ( ) => {
166191 return client . data
167192 . getter ( )
@@ -207,12 +232,12 @@ describe("data", () => {
207232 it ( "gets one thing by id only" , ( ) => {
208233 return client . data
209234 . getterById ( )
210- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
235+ . withId ( "00000000-0000-0000-0000-000000000000 " )
211236 . do ( )
212237 . then ( ( res ) => {
213238 expect ( res ) . toEqual (
214239 expect . objectContaining ( {
215- id : "1565c06c-463f-466c-9092-5930dbac3887 " ,
240+ id : "00000000-0000-0000-0000-000000000000 " ,
216241 properties : { stringProp : "with-id" } ,
217242 } )
218243 ) ;
@@ -224,12 +249,12 @@ describe("data", () => {
224249 return client . data
225250 . getterById ( )
226251 . withClassName ( thingClassName )
227- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
252+ . withId ( "00000000-0000-0000-0000-000000000000 " )
228253 . do ( )
229254 . then ( ( res ) => {
230255 expect ( res ) . toEqual (
231256 expect . objectContaining ( {
232- id : "1565c06c-463f-466c-9092-5930dbac3887 " ,
257+ id : "00000000-0000-0000-0000-000000000000 " ,
233258 properties : { stringProp : "with-id" } ,
234259 } )
235260 ) ;
@@ -241,7 +266,7 @@ describe("data", () => {
241266 return client . data
242267 . getterById ( )
243268 . withClassName ( "DoesNotExist" )
244- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
269+ . withId ( "00000000-0000-0000-0000-000000000000 " )
245270 . do ( )
246271 . catch ( err =>
247272 expect ( err ) . toEqual ( "usage error (404): " )
@@ -251,7 +276,7 @@ describe("data", () => {
251276 it ( "gets one thing by id with all optional additional props" , ( ) => {
252277 return client . data
253278 . getterById ( )
254- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
279+ . withId ( "00000000-0000-0000-0000-000000000000 " )
255280 . withAdditional ( "classification" )
256281 . withAdditional ( "interpretation" )
257282 . withAdditional ( "nearestNeighbors" )
@@ -282,7 +307,7 @@ describe("data", () => {
282307 } ) ;
283308
284309 it ( "updates a thing by id only" , ( ) => {
285- const id = "1565c06c-463f-466c-9092-5930dbac3887 " ;
310+ const id = "00000000-0000-0000-0000-000000000000 " ;
286311 return client . data
287312 . getterById ( )
288313 . withId ( id )
@@ -307,7 +332,7 @@ describe("data", () => {
307332 } ) ;
308333
309334 it ( "updates a thing by id and class name" , ( ) => {
310- const id = "1565c06c-463f-466c-9092-5930dbac3887 " ;
335+ const id = "00000000-0000-0000-0000-000000000000 " ;
311336 return client . data
312337 . getterById ( )
313338 . withId ( id )
@@ -332,7 +357,7 @@ describe("data", () => {
332357 } ) ;
333358
334359 it ( "merges a thing" , ( ) => {
335- const id = "1565c06c-463f-466c-9092-5930dbac3887 " ;
360+ const id = "00000000-0000-0000-0000-000000000000 " ;
336361 return client . data
337362 . getterById ( )
338363 . withId ( id )
@@ -353,7 +378,7 @@ describe("data", () => {
353378
354379 it ( "adds a reference to a thing by id only" , ( ) => {
355380 const sourceId = "599a0c64-5ed5-4d30-978b-6c9c45516db1" ;
356- const targetId = "1565c06c-463f-466c-9092-5930dbac3887 " ;
381+ const targetId = "00000000-0000-0000-0000-000000000000 " ;
357382
358383 return client . data
359384 . referenceCreator ( )
@@ -398,7 +423,7 @@ describe("data", () => {
398423
399424 it ( "adds a reference to a thing by id and class name" , ( ) => {
400425 const sourceId = "599a0c64-5ed5-4d30-978b-6c9c45516db1" ;
401- const targetId = "1565c06c-463f-466c-9092-5930dbac3887 " ;
426+ const targetId = "00000000-0000-0000-0000-000000000000 " ;
402427
403428 return client . data
404429 . referenceCreator ( )
@@ -447,7 +472,7 @@ describe("data", () => {
447472 it ( "checks that object exists by id only" , ( ) => {
448473 return client . data
449474 . checker ( )
450- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
475+ . withId ( "00000000-0000-0000-0000-000000000000 " )
451476 . do ( )
452477 . then ( ( exists ) => {
453478 if ( ! exists ) {
@@ -460,7 +485,7 @@ describe("data", () => {
460485 it ( "checks that object exists by id and class name" , ( ) => {
461486 return client . data
462487 . checker ( )
463- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
488+ . withId ( "00000000-0000-0000-0000-000000000000 " )
464489 . withClassName ( thingClassName )
465490 . do ( )
466491 . then ( ( exists ) => {
@@ -474,15 +499,15 @@ describe("data", () => {
474499 it ( "deletes a thing by id only" , ( ) => {
475500 return client . data
476501 . deleter ( )
477- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
502+ . withId ( "00000000-0000-0000-0000-000000000000 " )
478503 . do ( )
479504 . catch ( ( e ) => fail ( "it should not have errord: " + e ) ) ;
480505 } ) ;
481506
482507 it ( "checks that object doesn't exist anymore with delete by id only" , ( ) => {
483508 return client . data
484509 . checker ( )
485- . withId ( "1565c06c-463f-466c-9092-5930dbac3887 " )
510+ . withId ( "00000000-0000-0000-0000-000000000000 " )
486511 . do ( )
487512 . then ( ( exists ) => {
488513 if ( exists ) {
@@ -585,7 +610,7 @@ describe("data", () => {
585610 } ) ;
586611
587612 it ( "forms a get by id query with node_name set" , ( ) => {
588- const id = "1565c06c-463f-466c-9092-5930dbac3887 " ;
613+ const id = "00000000-0000-0000-0000-000000000000 " ;
589614
590615 return client . data
591616 . getterById ( )
@@ -602,7 +627,7 @@ describe("data", () => {
602627 } )
603628
604629 it ( "forms a get by id query with consistency_level set" , ( ) => {
605- const id = "1565c06c-463f-466c-9092-5930dbac3887 " ;
630+ const id = "00000000-0000-0000-0000-000000000000 " ;
606631
607632 return client . data
608633 . getterById ( )
0 commit comments