From 9fe320e293d40e162dbe814edc9792e196247ca8 Mon Sep 17 00:00:00 2001 From: Patrick Russell Date: Thu, 2 Oct 2025 22:51:35 -0700 Subject: [PATCH 1/2] Fix APAC region documentation and test expectations --- doc/api.md | 2 +- lib/init.js | 2 +- test/AdobeState.test.js | 2 +- types.d.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api.md b/doc/api.md index 454f8b0..7ec9147 100644 --- a/doc/api.md +++ b/doc/api.md @@ -196,7 +196,7 @@ OpenWhisk credentials can also be read from environment variables `__OW_NAMESPAC | --- | --- | --- | | [config] | object | used to init the sdk | | [config.ow] | [OpenWhiskCredentials](#OpenWhiskCredentials) | [OpenWhiskCredentials](#OpenWhiskCredentials). Set those if you want to use ootb credentials to access the state management service. OpenWhisk namespace and auth can also be passed through environment variables: `__OW_NAMESPACE` and `__OW_API_KEY` | -| [config.region] | string | optional region to use, accepted values: `amer` (default), `emea` | +| [config.region] | string | optional region to use, accepted values: `amer` (default), `emea`, `apac` | diff --git a/lib/init.js b/lib/init.js index bbe79c3..15de0eb 100644 --- a/lib/init.js +++ b/lib/init.js @@ -42,7 +42,7 @@ const { AdobeState } = require('./AdobeState') * to use ootb credentials to access the state management service. OpenWhisk * namespace and auth can also be passed through environment variables: * `__OW_NAMESPACE` and `__OW_API_KEY` - * @param {string} [config.region] optional region to use, accepted values: `amer` (default), `emea` + * @param {string} [config.region] optional region to use, accepted values: `amer` (default), `emea`, `apac` * @returns {Promise} An AdobeState instance */ async function init (config = {}) { diff --git a/test/AdobeState.test.js b/test/AdobeState.test.js index 9f73356..e26fd27 100644 --- a/test/AdobeState.test.js +++ b/test/AdobeState.test.js @@ -705,7 +705,7 @@ describe('private methods', () => { mockCLIEnv.mockReturnValue(env) await expect(AdobeState.init({ ...fakeCredentials, region })).rejects - .toThrow('[AdobeStateLib:ERROR_BAD_ARGUMENT] /region must be equal to one of the allowed values: amer, emea') + .toThrow('[AdobeStateLib:ERROR_BAD_ARGUMENT] /region must be equal to one of the allowed values: amer, emea, apac') }) }) diff --git a/types.d.ts b/types.d.ts index 33dd5be..d51483d 100644 --- a/types.d.ts +++ b/types.d.ts @@ -165,7 +165,7 @@ export type OpenWhiskCredentials = { * to use ootb credentials to access the state management service. OpenWhisk * namespace and auth can also be passed through environment variables: * `__OW_NAMESPACE` and `__OW_API_KEY` - * @param [config.region] - optional region to use, accepted values: `amer` (default), `emea` + * @param [config.region] - optional region to use, accepted values: `amer` (default), `emea`, `apac` * @returns An AdobeState instance */ export function init(config?: { From 6d528a75602c98226302977548f4484b7bf508aa Mon Sep 17 00:00:00 2001 From: Shazron Abdullah <36107+shazron@users.noreply.github.com> Date: Fri, 3 Oct 2025 18:55:22 +0800 Subject: [PATCH 2/2] fix: make the error message match exactly the previous way was a substring match --- test/AdobeState.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/AdobeState.test.js b/test/AdobeState.test.js index e26fd27..dd37824 100644 --- a/test/AdobeState.test.js +++ b/test/AdobeState.test.js @@ -705,7 +705,7 @@ describe('private methods', () => { mockCLIEnv.mockReturnValue(env) await expect(AdobeState.init({ ...fakeCredentials, region })).rejects - .toThrow('[AdobeStateLib:ERROR_BAD_ARGUMENT] /region must be equal to one of the allowed values: amer, emea, apac') + .toThrow(new Error('[AdobeStateLib:ERROR_BAD_ARGUMENT] /region must be equal to one of the allowed values: amer, emea, apac')) }) })