Technical guides

Testing

Implement automated tests to verify API connectivity, authentication, and data retrieval. Regular testing ensures your integration remains reliable.


What to test

  • /System/Echo returns 200
  • Authenticated requests succeed
  • Pagination headers are present when paged
  • Error codes map to clear UI messages

Use case: A CI job blocks deployment if API health or auth fails.


Example: minimal smoke test

import assert from 'node:assert/strict'

const baseUrl = 'https://api.hlc.bike/us/v3.0'
const apiKey = process.env.HLC_API_KEY

const echo = await fetch(`${baseUrl}/System/Echo`)
assert.equal(echo.status, 200)

const brands = await fetch(`${baseUrl}/Catalog/Brands`, {
  headers: { ApiKey: apiKey },
})
assert.equal(brands.status, 200)
Previous
Pagination