@@ -12,17 +12,18 @@ test('Hydrate Skus', async () => {
1212 expect ( response . product1 . path ) . toBe ( '/shop/bathroom-fitting/mounted-bathroom-counter-with-shelf' ) ;
1313} ) ;
1414
15- test ( 'Hydrate Skus by using the sync API' , async ( ) => {
16- const CrystallizeClient = createClient ( {
17- tenantIdentifier : 'furniture' ,
18- tenantId : '5e662ccf734ba3f6151ee528' ,
19- accessTokenId : process . env . CRYSTALLIZE_ACCESS_TOKEN_ID ,
20- accessTokenSecret : process . env . CRYSTALLIZE_ACCESS_TOKEN_SECRET ,
21- } ) ;
15+ test ( 'Hydrate Skus by using the sync API, should failed with no credentials' , async ( ) => {
16+ try {
17+ const CrystallizeClient = createClient ( {
18+ tenantIdentifier : 'furniture' ,
19+ tenantId : '5e662ccf734ba3f6151ee528' ,
20+ // accessTokenId: process.env.CRYSTALLIZE_ACCESS_TOKEN_ID,
21+ // accessTokenSecret: process.env.CRYSTALLIZE_ACCESS_TOKEN_SECRET,
22+ } ) ;
2223
23- const hydrater = createProductHydrater ( CrystallizeClient , { useSyncApiForSKUs : true } ) . bySkus ;
24- const response = await hydrater ( [ 'b-1628520141076' , 'b-1628514494819' ] , 'en' ) ;
25-
26- expect ( response . product0 . path ) . toBe ( '/shop/bathroom-fitting/large-mounted-cabinet-in-treated-wood' ) ;
27- expect ( response . product1 . path ) . toBe ( '/shop/bathroom-fitting/mounted-bathroom-counter-with-shelf' ) ;
24+ const hydrater = createProductHydrater ( CrystallizeClient , { useSyncApiForSKUs : true } ) . bySkus ;
25+ await hydrater ( [ 'b-1628520141076' , 'b-1628514494819' ] , 'en' ) ;
26+ } catch ( exception ) {
27+ expect ( exception . code ) . toBe ( 403 ) ;
28+ }
2829} ) ;
0 commit comments