fix(cloudinary): update config object shape (#2044)

This commit is contained in:
amitkhanal 2019-03-11 07:51:01 -07:00 committed by Shawn Erquhart
parent 63582dcbc7
commit b42a9c69db
2 changed files with 6 additions and 6 deletions

View File

@ -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);
});
});

View File

@ -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,