import { getConfig } from './getConfig' describe('getConfig', () => { it('should throw is required options are not defined', () => { expect(() => getConfig()).toThrow('Missing required options') expect(() => getConfig({ projectId: '' })).toThrow( 'Missing required options' ) expect(() => getConfig({ projectToken: '' })).toThrow( 'Missing required options' ) expect(() => getConfig({ spaceHost: 'space.host.io' })).toThrow( 'Missing required options' ) expect(() => getConfig({ projectId: '', projectToken: '' }) ).toThrow('Missing required options') expect(() => getConfig({ spaceHost: 'space.host.io', projectToken: '' }) ).toThrow('Missing required options') expect(() => getConfig({ projectId: '', spaceHost: 'space.host.io' }) ).toThrow('Missing required options') }) it('should return baseUrl property if one is not defined', () => { expect( getConfig({ projectId: '', projectToken: '', spaceHost: 'space.host.io', }) ).toHaveProperty('baseUrl') }) it('should allow to overwrite the spaceHost', () => { expect( getConfig({ projectId: '', projectToken: '', spaceHost: 'sg.test.io', }).baseUrl ).toBe('https://sg.test.io/api/') }) })