From bb28213e0a461f76fc897788c443e6558d0b4976 Mon Sep 17 00:00:00 2001 From: Blake Wilson Date: Fri, 11 Jun 2021 11:02:17 -0500 Subject: [PATCH] fix: (#266) fix headlessConfig() setter (#267) --- packages/core/src/config/config.ts | 2 +- packages/core/test/config/config.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index 3067f110e..2c5be82f6 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -143,7 +143,7 @@ export function headlessConfig(config?: HeadlessConfig): HeadlessConfig { } configSet = true; - wpeConfig = normalizeConfig(wpeConfig); + wpeConfig = normalizeConfig(config); return wpeConfig; } diff --git a/packages/core/test/config/config.test.ts b/packages/core/test/config/config.test.ts index d7741789d..d4e8f518c 100644 --- a/packages/core/test/config/config.test.ts +++ b/packages/core/test/config/config.test.ts @@ -22,6 +22,15 @@ describe('config/config', () => { expect(headlessConfig()).toBe(config); }); + test('headlessConfig() should return the set wpUrl', () => { + const cfg = { + wpUrl: 'http://wpengine.com', + }; + + let config = headlessConfig(cfg); + expect(config.wpUrl).toBe(cfg.wpUrl); + }); + test('headlessConfig() arguments should be immutable', () => { const cfg = { wpUrl: '',