@defra/lis-hubs-infra-core 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/lis-hubs-infra-core",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared hub mechanics for livestock platform.",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -62,7 +62,7 @@ async function fetchToken(audience) {
62
62
 
63
63
  const expiresAt = new Date(response.Expiration).getTime()
64
64
  if (Number.isNaN(expiresAt)) {
65
- throw new Error('STS response did not include a valid Expiration')
65
+ throw new TypeError('STS response did not include a valid Expiration')
66
66
  }
67
67
 
68
68
  cache.set(audience, { token: response.WebIdentityToken, expiresAt })
@@ -316,6 +316,7 @@ describe('getServiceToken()', () => {
316
316
  }
317
317
 
318
318
  // Assert
319
+ expect(error).toBeInstanceOf(TypeError)
319
320
  expect(error.message).toBe(
320
321
  'STS response did not include a valid Expiration'
321
322
  )