From b42a9c69db4eb9aba4aff38afb85c7aef4ca3353 Mon Sep 17 00:00:00 2001 From: amitkhanal Date: Mon, 11 Mar 2019 07:51:01 -0700 Subject: [PATCH] fix(cloudinary): update config object shape (#2044) --- .../src/__tests__/index.spec.js | 10 +++++----- .../netlify-cms-media-library-cloudinary/src/index.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js b/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js index f9a3afe8..b641162b 100644 --- a/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js +++ b/packages/netlify-cms-media-library-cloudinary/src/__tests__/index.spec.js @@ -197,7 +197,7 @@ Object { it('calls cloudinary instance show method with default options', async () => { const integration = await cloudinary.init(); integration.show(); - expect(mediaLibrary.show).toHaveBeenCalledWith(defaultOptions); + expect(mediaLibrary.show).toHaveBeenCalledWith(defaultOptions.config); }); it('accepts unknown configuration keys', async () => { @@ -209,7 +209,7 @@ Object { }; const integration = await cloudinary.init(); integration.show(showOptions); - expect(mediaLibrary.show).toHaveBeenCalledWith(showOptions); + expect(mediaLibrary.show).toHaveBeenCalledWith(showOptions.config); }); it('receives global configuration for behavior only', async () => { @@ -232,7 +232,7 @@ Object { }; const integration = await cloudinary.init({ options }); integration.show(); - expect(mediaLibrary.show).toHaveBeenCalledWith(expectedOptions); + expect(mediaLibrary.show).toHaveBeenCalledWith(expectedOptions.config); }); it('allows global/default configuration to be overridden', async () => { @@ -243,7 +243,7 @@ Object { }; const integration = await cloudinary.init(); integration.show(showOptions); - expect(mediaLibrary.show).toHaveBeenCalledWith(showOptions); + expect(mediaLibrary.show).toHaveBeenCalledWith(showOptions.config); }); it('enforces multiple: false if allowMultiple is false', async () => { @@ -265,7 +265,7 @@ Object { }; const integration = await cloudinary.init(options); integration.show(showOptions); - expect(mediaLibrary.show).toHaveBeenCalledWith(expectedOptions); + expect(mediaLibrary.show).toHaveBeenCalledWith(expectedOptions.config); }); }); diff --git a/packages/netlify-cms-media-library-cloudinary/src/index.js b/packages/netlify-cms-media-library-cloudinary/src/index.js index 23211098..44da30ca 100644 --- a/packages/netlify-cms-media-library-cloudinary/src/index.js +++ b/packages/netlify-cms-media-library-cloudinary/src/index.js @@ -74,7 +74,7 @@ async function init({ options = {}, handleInsert } = {}) { if (allowMultiple === false) { instanceConfig.multiple = false; } - return mediaLibrary.show({ config: { ...cloudinaryBehaviorConfig, ...instanceConfig } }); + return mediaLibrary.show({ ...cloudinaryBehaviorConfig, ...instanceConfig }); }, hide: () => mediaLibrary.hide(), enableStandalone: () => true,