fix: expandable textarea should save on blur (#325)
This commit is contained in:
@@ -288,7 +288,7 @@ export const processLicense = (licenseType, licenseDetails) => {
|
||||
|
||||
export const checkMockApi = (key) => {
|
||||
if (process.env.REACT_APP_DEVGALLERY) {
|
||||
return mockApi[key];
|
||||
return mockApi[key] ? mockApi[key] : mockApi.emptyMock;
|
||||
}
|
||||
return module.apiMethods[key];
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as utils from '../../../utils';
|
||||
import * as api from './api';
|
||||
import * as mockApi from './mockApi';
|
||||
import * as urls from './urls';
|
||||
import { get, post, deleteObject } from './utils';
|
||||
|
||||
@@ -547,6 +548,31 @@ describe('cms api', () => {
|
||||
expect(api.processLicense(licenseType, licenseDetails)).toEqual('all-rights-reserved');
|
||||
});
|
||||
});
|
||||
describe('checkMockApi', () => {
|
||||
const envTemp = process.env;
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
process.env = { ...envTemp };
|
||||
});
|
||||
afterEach(() => {
|
||||
process.env = envTemp;
|
||||
});
|
||||
describe('if REACT_APP_DEVGALLERY is true', () => {
|
||||
it('should return the mockApi version of a call when it exists', () => {
|
||||
process.env.REACT_APP_DEVGALLERY = true;
|
||||
expect(api.checkMockApi('fetchBlockById')).toEqual(mockApi.fetchBlockById);
|
||||
});
|
||||
it('should return an empty mock when the call does not exist', () => {
|
||||
process.env.REACT_APP_DEVGALLERY = true;
|
||||
expect(api.checkMockApi('someRAnDomThINg')).toEqual(mockApi.emptyMock);
|
||||
});
|
||||
});
|
||||
describe('if REACT_APP_DEVGALLERY is not true', () => {
|
||||
it('should return the appropriate call', () => {
|
||||
expect(api.checkMockApi('fetchBlockById')).toEqual(apiMethods.fetchBlockById);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('fetchVideoFeatures', () => {
|
||||
it('should call get with url.videoFeatures', () => {
|
||||
const args = { studioEndpointUrl, learningContextId };
|
||||
|
||||
@@ -291,8 +291,4 @@ export const fetchStudioView = ({ blockId, studioEndpointUrl }) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const checkTranscriptsForImport = () => mockPromise({});
|
||||
|
||||
export const uploadTranscript = () => mockPromise({});
|
||||
|
||||
export const fetchAdvancedSettings = () => mockPromise({});
|
||||
export const emptyMock = () => mockPromise({});
|
||||
|
||||
Reference in New Issue
Block a user