mirror of
https://github.com/Kong/insomnia.git
synced 2026-11-03 03:25:26 -05:00
add initial settings for legacy test add initial check for legacy unit test suites show dropdown remove spec route and merged with default debug page showing document as collection remove document term in UI fix lint issue fix ut failures
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import type { Query, UnitTestSuite } from 'insomnia-data';
|
|
import { database as db, models } from 'insomnia-data';
|
|
|
|
const { type } = models.unitTestSuite;
|
|
|
|
export function create(patch: Partial<UnitTestSuite> = {}) {
|
|
if (!patch.parentId) {
|
|
throw new Error('New UnitTestSuite missing `parentId` ' + JSON.stringify(patch));
|
|
}
|
|
|
|
return db.docCreate<UnitTestSuite>(type, patch);
|
|
}
|
|
|
|
export function update(unitTestSuite: UnitTestSuite, patch: Partial<UnitTestSuite> = {}) {
|
|
return db.docUpdate<UnitTestSuite>(unitTestSuite, patch);
|
|
}
|
|
|
|
export function remove(unitTestSuite: UnitTestSuite) {
|
|
return db.remove(unitTestSuite);
|
|
}
|
|
|
|
export function getByParentId(parentId: string) {
|
|
return db.findOne<UnitTestSuite>(type, { parentId });
|
|
}
|
|
|
|
export function findByParentId(parentId: string) {
|
|
return db.find<UnitTestSuite>(type, { parentId });
|
|
}
|
|
|
|
export const getById = (_id: string) => db.findOne<UnitTestSuite>(type, { _id });
|
|
|
|
export function all() {
|
|
return db.find<UnitTestSuite>(type);
|
|
}
|
|
|
|
export function count(query?: Query<UnitTestSuite>) {
|
|
return db.count(type, query);
|
|
}
|