Skip to content

Merge pull request #93 from contentstack/development

38e1d5d
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

DX | 24-01-2025 | Release | Hotfix #91

Merge pull request #93 from contentstack/development
38e1d5d
Select commit
Loading
Failed to load commit list.
This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / JEST Tests succeeded Jan 23, 2025 in 0s

40 passed, 0 failed and 0 skipped

Tests passed successfully

✅ reports/contentstack-js-core/junit/jest-junit.xml

40 tests were completed in 5s with 40 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/contentstack-core.spec.ts 13✅ 3s
test/contentstack-error.spec.ts 4✅ 105ms
test/param-serializer.spec.ts 5✅ 119ms
test/request.spec.ts 6✅ 3s
test/retryPolicy/delivery-sdk-handlers.spec.ts 12✅ 3s

✅ test/contentstack-core.spec.ts

contentstackCore
  ✅ should return default config when no config is passed
contentstackCore › logHandler
  ✅ should log an error message when level is "error" and data is provided
  ✅ should not log anything when level is "error" and no data is provided
  ✅ should log a message with the provided level and data
contentstackCore › retryCondition
  ✅ should return true when error response status is 429
  ✅ should return false when error response status is not 429
  ✅ should return false when error response is not present
contentstackCore › config.headers
  ✅ should include apiKey in headers when provided
  ✅ should include accessToken in headers when provided
  ✅ should not include apiKey in headers when not provided
  ✅ should not include accessToken in headers when not provided
contentstackCore › config.onError
  ✅ should call the onError function when an error occurs
  ✅ should not call the onError function when no error occurs

✅ test/contentstack-error.spec.ts

Contentstack Error
  ✅ should throw an error with proper details
  ✅ should throw an error with a default message if response or config is not present
  ✅ should throw an error with a default details if response data is not present
  ✅ should throw an error with proper details when response.data is not available

✅ test/param-serializer.spec.ts

serialize
  ✅ should return blank string when passed empty params
  ✅ should return brackets structure when param contains array value
  ✅ should return non brackets string when param value is not array value
  ✅ should return query with encode string when passed query param
  ✅ should return brackets and query with encoded string when passed query param and array value

✅ test/request.spec.ts

Request tests
  ✅ should fetch successfully data from an API
  ✅ should handle errors
  ✅ should throw error when host is required for live preview
  ✅ should handle live_preview with enable=true and live_preview=init
  ✅ should set baseURL correctly when host is provided without https://
  ✅ should not modify baseURL when host is already prefixed with https://

✅ test/retryPolicy/delivery-sdk-handlers.spec.ts

retryRequestHandler
  ✅ should add retryCount to the request config
retryResponseHandler
  ✅ should return the response as-is
retryResponseErrorHandler
  ✅ should reject the promise if retryOnError is false
  ✅ should reject the promise if retryOnError is true
  ✅ should resolve the promise to 408 error if retryOnError is true and error code is ECONNABORTED
  ✅ should reject the promise if response status is 429 and retryCount exceeds retryLimit
  ✅ should reject the promise if response status is 401 and retryCount exceeds retryLimit
  ✅ should reject the promise if response status is 429 or 401 and retryCount is within limit
  ✅ should call the retry function if retryCondition is passed
  ✅ should reject to error when retryCondition is passed but retryLimit is exceeded
  ✅ should retry when response status is 429 and retryCount is less than retryLimit
  ✅ should retry when retryCondition is true