mirror of
https://github.com/Kong/insomnia.git
synced 2026-06-03 13:47:23 -04:00
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
29 lines
798 B
TypeScript
29 lines
798 B
TypeScript
import { models } from 'insomnia-data';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
const { getModel, mustGetModel } = models;
|
|
|
|
describe('index', () => {
|
|
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.');
|
|
});
|
|
});
|
|
});
|