mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
5f4c19da35
Co-authored-by: Opender Singh <opender.singh@konghq.com>
29 lines
849 B
TypeScript
29 lines
849 B
TypeScript
import { globalBeforeEach } from '../../__jest__/before-each';
|
|
import { getModel, mustGetModel } from '../index';
|
|
import * as models from '../index';
|
|
|
|
describe('index', () => {
|
|
beforeEach(globalBeforeEach);
|
|
describe('getModel()', () => {
|
|
it('should get model if found', () => {
|
|
expect(getModel(models.workspace.type)).not.toBeNull();
|
|
});
|
|
|
|
it('should return null if model not found', () => {
|
|
expect(getModel('UNKNOWN')).toBeNull();
|
|
});
|
|
});
|
|
|
|
describe('mustGetModel()', () => {
|
|
it('should get model if found', () => {
|
|
expect(mustGetModel(models.workspace.type)).not.toBeNull();
|
|
});
|
|
|
|
it('should return null if model not found', () => {
|
|
const func = () => mustGetModel('UNKNOWN');
|
|
|
|
expect(func).toThrowError('The model type UNKNOWN must exist but could not be found.');
|
|
});
|
|
});
|
|
});
|