gitlab-org--gitlab-foss/spec/javascripts/error_tracking_settings/utils_spec.js
Reuben Pereira 43e713eb41 Refactor model and spec
- Move some specs into contexts
- Let get_slugs method take a parameter and return a specific slug.
- Add rescues when using Addressable::URI.
2019-03-01 14:51:54 +00:00

29 lines
942 B
JavaScript

import { transformFrontendSettings } from '~/error_tracking_settings/utils';
import { sampleFrontendSettings, transformedSettings } from './mock';
describe('error tracking settings utils', () => {
describe('data transform functions', () => {
it('should transform settings successfully for the backend', () => {
expect(transformFrontendSettings(sampleFrontendSettings)).toEqual(transformedSettings);
});
it('should transform empty values in the settings object to null', () => {
const emptyFrontendSettingsObject = {
apiHost: '',
enabled: false,
token: '',
selectedProject: null,
};
const transformedEmptySettingsObject = {
api_host: null,
enabled: false,
token: null,
project: null,
};
expect(transformFrontendSettings(emptyFrontendSettingsObject)).toEqual(
transformedEmptySettingsObject,
);
});
});
});