33 * Module Dependencies.
44 */
55const Contentstack = require ( "../../dist/node/contentstack.js" ) ;
6- const init = require ( "../sync_config.js" ) ;
6+ const init = require ( "../config.js" ) ;
7+
78
89let Stack ;
910let sync_token = "" ;
@@ -14,12 +15,7 @@ describe("ContentStack SDK Sync Tests", () => {
1415 beforeAll ( ( ) => {
1516 return new Promise ( ( resolve ) => {
1617 // Initialize Stack with proper configuration
17- Stack = Contentstack . Stack ( {
18- api_key : init . stack . api_key ,
19- delivery_token : init . stack . access_token ,
20- environment : init . stack . environment ,
21- fetchOptions : init . stack . fetchOptions
22- } ) ;
18+ Stack = Contentstack . Stack ( init . stack )
2319 Stack . setHost ( init . host ) ;
2420 setTimeout ( resolve , 1000 ) ;
2521 } ) ;
@@ -65,12 +61,16 @@ describe("ContentStack SDK Sync Tests", () => {
6561
6662 describe ( "default .pagination_token()" , ( ) => {
6763 test ( "should handle pagination correctly" , async ( ) => {
68- // First get a valid pagination token
64+ // This works only when it contains more than 100 records else sync token will be generated
65+
6966 const initialData = await Stack . sync ( { init : "true" } ) ;
7067 pagination_token = initialData . pagination_token ;
71-
72- const result = await Stack . sync ( { pagination_token } ) ;
73- expect ( result . items . length ) . toBeDefined ( ) ;
68+ expect ( pagination_token ) . toBeUndefined ( ) ;
69+ try {
70+ await Stack . sync ( { pagination_token } ) ;
71+ } catch ( error ) {
72+ expect ( error . message ) . toBe ( `Invalid parameter value for key "pagination_token": must be a string, number, object, boolean, or RegExp.` ) ;
73+ }
7474 } ) ;
7575 } ) ;
7676
0 commit comments