mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Add unit tests to cli db fixtures (#2350)
This commit is contained in:
parent
8d6e797465
commit
dcd182caf1
@ -3,13 +3,12 @@ contentType: yaml
|
||||
contents: |
|
||||
openapi: '3.0.2'
|
||||
info:
|
||||
title: Global Security
|
||||
title: Sample Spec
|
||||
version: '1.2'
|
||||
servers:
|
||||
- url: https://api.server.test/v1
|
||||
- url: https://200.insomnia.rest
|
||||
tags:
|
||||
- name: Folder
|
||||
|
||||
paths:
|
||||
/global:
|
||||
get:
|
||||
@ -20,13 +19,11 @@ contents: |
|
||||
description: OK
|
||||
/override:
|
||||
get:
|
||||
security:
|
||||
- Key-Query: []
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
created: 1589851906273
|
||||
fileName: Global Security
|
||||
modified: 1592254074772
|
||||
fileName: Sample Specification
|
||||
modified: 1593669699123
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
type: ApiSpec
|
||||
|
@ -8,7 +8,7 @@ dataPropertyOrder:
|
||||
- base_url
|
||||
isPrivate: false
|
||||
metaSortKey: 1589851906358
|
||||
modified: 1592254074769
|
||||
modified: 1593669699118
|
||||
name: Base environment
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
type: Environment
|
||||
|
@ -2,13 +2,13 @@ _id: env_env_ca046a738f001eb3090261a537b1b78f86c2094c_sub
|
||||
color: null
|
||||
created: 1592252904087
|
||||
data:
|
||||
base_path: /v1
|
||||
host: api.server.test
|
||||
base_path: ""
|
||||
host: 200.insomnia.rest
|
||||
scheme: https
|
||||
dataPropertyOrder: null
|
||||
isPrivate: false
|
||||
metaSortKey: 1592252904087
|
||||
modified: 1592254074767
|
||||
modified: 1593669699117
|
||||
name: OpenAPI env
|
||||
parentId: env_ca046a738f001eb3090261a537b1b78f86c2094c
|
||||
type: Environment
|
||||
|
@ -1,13 +1,13 @@
|
||||
_id: req_wrk_012d4860c7da418a85ffea7406e1292a21946b60
|
||||
authentication: {}
|
||||
body: {}
|
||||
created: 1592254074764
|
||||
created: 1593669324881
|
||||
description: ""
|
||||
headers: []
|
||||
isPrivate: false
|
||||
metaSortKey: -1592254074764
|
||||
metaSortKey: -1593669324881
|
||||
method: GET
|
||||
modified: 1592254074764
|
||||
modified: 1593669699112
|
||||
name: /global
|
||||
parameters: []
|
||||
parentId: fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249
|
||||
|
@ -1,13 +1,13 @@
|
||||
_id: req_wrk_012d4860c7da418a85ffea7406e1292ab410454b
|
||||
authentication: {}
|
||||
body: {}
|
||||
created: 1592254074762
|
||||
created: 1593669324879
|
||||
description: ""
|
||||
headers: []
|
||||
isPrivate: false
|
||||
metaSortKey: -1592254074762
|
||||
metaSortKey: -1593669324879
|
||||
method: GET
|
||||
modified: 1592254074762
|
||||
modified: 1593669699110
|
||||
name: /override
|
||||
parameters: []
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
|
@ -1,10 +1,10 @@
|
||||
_id: fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249
|
||||
created: 1592254074765
|
||||
created: 1593669324883
|
||||
description: ""
|
||||
environment: {}
|
||||
environmentPropertyOrder: null
|
||||
metaSortKey: -1592254074765
|
||||
modified: 1592254074765
|
||||
metaSortKey: -1593669324883
|
||||
modified: 1593669699114
|
||||
name: Folder
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
type: RequestGroup
|
||||
|
@ -0,0 +1,8 @@
|
||||
_id: ut_6b214a8cd07046f2a8f43237ca913c73
|
||||
code: expect(insomnia.activeRequestId).to.equal('req_wrk_012d4860c7da418a85ffea7406e1292a21946b60')
|
||||
created: 1593668846292
|
||||
modified: 1593669592203
|
||||
name: Expect active request to be set
|
||||
parentId: uts_fe901c6565044f00aa620d3fe47f443f
|
||||
requestId: req_wrk_012d4860c7da418a85ffea7406e1292a21946b60
|
||||
type: UnitTest
|
@ -0,0 +1,8 @@
|
||||
_id: ut_8c0c020fb9e341c2a3162e723445faf1
|
||||
code: expect(1+1).to.equal(2);
|
||||
created: 1593668670236
|
||||
modified: 1593668678950
|
||||
name: One plus one is two
|
||||
parentId: uts_fe901c6565044f00aa620d3fe47f443f
|
||||
requestId: null
|
||||
type: UnitTest
|
@ -0,0 +1,8 @@
|
||||
_id: ut_8fc42ec7f82a45d09e691ddfe212fd85
|
||||
code: expect(true).not.to.equal(true);
|
||||
created: 1593668581197
|
||||
modified: 1593669248598
|
||||
name: Test should fail
|
||||
parentId: uts_7f0f85548b0147f4ba6b5e442d137613
|
||||
requestId: null
|
||||
type: UnitTest
|
@ -0,0 +1,8 @@
|
||||
_id: ut_97a197104e83454ebf5f4e0dc0ba4bc6
|
||||
code: expect(true).to.equal(true);
|
||||
created: 1593668468718
|
||||
modified: 1593669244289
|
||||
name: Test should succeed
|
||||
parentId: uts_7f0f85548b0147f4ba6b5e442d137613
|
||||
requestId: null
|
||||
type: UnitTest
|
@ -0,0 +1,6 @@
|
||||
_id: uts_7f0f85548b0147f4ba6b5e442d137613
|
||||
created: 1593668430232
|
||||
modified: 1593669651173
|
||||
name: A test suite
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
type: UnitTestSuite
|
@ -0,0 +1,6 @@
|
||||
_id: uts_fe901c6565044f00aa620d3fe47f443f
|
||||
created: 1593668662131
|
||||
modified: 1593668662131
|
||||
name: Another suite
|
||||
parentId: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
type: UnitTestSuite
|
@ -1,8 +1,8 @@
|
||||
_id: wrk_012d4860c7da418a85ffea7406e1292a
|
||||
created: 1589851906270
|
||||
description: ""
|
||||
modified: 1592254074771
|
||||
name: Global Security 1.2
|
||||
modified: 1593669699121
|
||||
name: Sample Spec 1.2
|
||||
parentId: null
|
||||
scope: spec
|
||||
type: Workspace
|
||||
|
@ -1,2 +1,2 @@
|
||||
{"_id":"spc_46c5a4a40e83445a9bd9d9758b86c16c","type":"ApiSpec","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593115261448,"created":1589851906273,"fileName":"Global Security","contents":"openapi: '3.0.2'\ninfo:\n title: Global Security\n version: '1.2'\nservers:\n - url: https://api.server.test/v1\ntags:\n - name: Folder\n\npaths:\n /global:\n get:\n tags:\n - Folder\n responses:\n '200':\n description: OK\n /override:\n get:\n security:\n - Key-Query: []\n responses:\n '200':\n description: OK\n","contentType":"yaml"}
|
||||
{"_id":"spc_be9dcae4b7cd415d9c84485ebca7aa34","type":"ApiSpec","parentId":"wrk_fa232a1bfad44ed78754492995d8c949","modified":1593414279520,"created":1593412428545,"fileName":"tsttestst","contents":"openapi: '3.0.2'\ninfo:\n title: Global Security\n version: '1.2'\nservers:\n - url: https://api.server.test/v1\ntags:\n - name: Folder\n\npaths:\n /global:\n get:\n tags:\n - Folder\n responses:\n '200':\n description: OK\n /override:\n get:\n security:\n - Key-Query: []\n responses:\n '200':\n description: OK\n","contentType":"yaml"}
|
||||
{"_id":"spc_46c5a4a40e83445a9bd9d9758b86c16c","type":"ApiSpec","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593669699123,"created":1589851906273,"fileName":"Sample Specification","contents":"openapi: '3.0.2'\ninfo:\n title: Sample Spec\n version: '1.2'\nservers:\n - url: https://200.insomnia.rest\ntags:\n - name: Folder\npaths:\n /global:\n get:\n tags:\n - Folder\n responses:\n '200':\n description: OK\n /override:\n get:\n responses:\n '200':\n description: OK\n","contentType":"yaml"}
|
||||
{"_id":"spc_c21a60dc02eb4c44a0817046c2b06499","type":"ApiSpec","parentId":"wrk_0b96eff84c1c4eaa9c6e67ad74bbc85b","modified":1593670005359,"created":1593670005359,"fileName":"Insomnia Designer","contents":"","contentType":"yaml"}
|
||||
|
@ -1,4 +1,3 @@
|
||||
{"_id":"env_856e3d37128142beb6bc265c5f03cd28","type":"Environment","parentId":"wrk_fa232a1bfad44ed78754492995d8c949","modified":1593412428539,"created":1593412428539,"name":"Base environment","data":{"base_url":"{{ scheme }}://{{ host }}{{ base_path }}"},"dataPropertyOrder":{"&":["base_url"]},"color":null,"isPrivate":false,"metaSortKey":1589851906358}
|
||||
{"_id":"env_bd596b55333b46a09cd20de91b2a4356","type":"Environment","parentId":"env_856e3d37128142beb6bc265c5f03cd28","modified":1593412428540,"created":1593412428540,"name":"OpenAPI env","data":{"base_path":"/v1","host":"api.server.test","scheme":"https"},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1592252904087}
|
||||
{"_id":"env_ca046a738f001eb3090261a537b1b78f86c2094c","type":"Environment","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593115261445,"created":1589851906358,"name":"Base environment","data":{"base_url":"{{ scheme }}://{{ host }}{{ base_path }}"},"dataPropertyOrder":{"&":["base_url"]},"color":null,"isPrivate":false,"metaSortKey":1589851906358}
|
||||
{"_id":"env_env_ca046a738f001eb3090261a537b1b78f86c2094c_sub","type":"Environment","parentId":"env_ca046a738f001eb3090261a537b1b78f86c2094c","modified":1593115261442,"created":1592252904087,"name":"OpenAPI env","data":{"base_path":"/v1","host":"api.server.test","scheme":"https"},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1592252904087}
|
||||
{"_id":"env_8ec3efddba99277cc6df1bcc5b7afc7a06dc077f","type":"Environment","parentId":"wrk_0b96eff84c1c4eaa9c6e67ad74bbc85b","modified":1593670005431,"created":1593670005431,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1593670005431}
|
||||
{"_id":"env_ca046a738f001eb3090261a537b1b78f86c2094c","type":"Environment","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593669699118,"created":1589851906358,"name":"Base environment","data":{"base_url":"{{ scheme }}://{{ host }}{{ base_path }}"},"dataPropertyOrder":{"&":["base_url"]},"color":null,"isPrivate":false,"metaSortKey":1589851906358}
|
||||
{"_id":"env_env_ca046a738f001eb3090261a537b1b78f86c2094c_sub","type":"Environment","parentId":"env_ca046a738f001eb3090261a537b1b78f86c2094c","modified":1593669699117,"created":1592252904087,"name":"OpenAPI env","data":{"base_path":"","host":"200.insomnia.rest","scheme":"https"},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1592252904087}
|
||||
|
@ -1,4 +1,2 @@
|
||||
{"_id":"req_8849726d76e048708f410c493ba51266","type":"Request","parentId":"fld_6aec31470aca4243b6a82b75e1e4c806","modified":1593412428547,"created":1593412428547,"url":"{{ base_url }}/global","name":"/global","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1592254074764,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
{"_id":"req_c1913490d4f043c6a4e29c1e27eb82d6","type":"Request","parentId":"wrk_fa232a1bfad44ed78754492995d8c949","modified":1593412428549,"created":1593412428549,"url":"{{ base_url }}/override","name":"/override","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1592254074762,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
{"_id":"req_wrk_012d4860c7da418a85ffea7406e1292a21946b60","type":"Request","parentId":"fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249","modified":1593115261438,"created":1592254074764,"url":"{{ base_url }}/global","name":"/global","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1592254074764,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
{"_id":"req_wrk_012d4860c7da418a85ffea7406e1292ab410454b","type":"Request","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593115261435,"created":1592254074762,"url":"{{ base_url }}/override","name":"/override","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1592254074762,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
{"_id":"req_wrk_012d4860c7da418a85ffea7406e1292a21946b60","type":"Request","parentId":"fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249","modified":1593669699112,"created":1593669324881,"url":"{{ base_url }}/global","name":"/global","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1593669324881,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
{"_id":"req_wrk_012d4860c7da418a85ffea7406e1292ab410454b","type":"Request","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593669699110,"created":1593669324879,"url":"{{ base_url }}/override","name":"/override","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":-1593669324879,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global"}
|
||||
|
@ -1,2 +1 @@
|
||||
{"_id":"fld_6aec31470aca4243b6a82b75e1e4c806","type":"RequestGroup","parentId":"wrk_fa232a1bfad44ed78754492995d8c949","modified":1593412428546,"created":1593412428546,"name":"Folder","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1592254074765}
|
||||
{"_id":"fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249","type":"RequestGroup","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593115261439,"created":1592254074765,"name":"Folder","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1592254074765}
|
||||
{"_id":"fld_wrk_012d4860c7da418a85ffea7406e1292a30baa249","type":"RequestGroup","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593669699114,"created":1593669324883,"name":"Folder","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1593669324883}
|
||||
|
@ -0,0 +1,4 @@
|
||||
{"_id":"ut_6b214a8cd07046f2a8f43237ca913c73","type":"UnitTest","parentId":"uts_fe901c6565044f00aa620d3fe47f443f","modified":1593669592203,"created":1593668846292,"requestId":"req_wrk_012d4860c7da418a85ffea7406e1292a21946b60","name":"Expect active request to be set","code":"expect(insomnia.activeRequestId).to.equal('req_wrk_012d4860c7da418a85ffea7406e1292a21946b60')"}
|
||||
{"_id":"ut_8c0c020fb9e341c2a3162e723445faf1","type":"UnitTest","parentId":"uts_fe901c6565044f00aa620d3fe47f443f","modified":1593668678950,"created":1593668670236,"requestId":null,"name":"One plus one is two","code":"expect(1+1).to.equal(2);"}
|
||||
{"_id":"ut_8fc42ec7f82a45d09e691ddfe212fd85","type":"UnitTest","parentId":"uts_7f0f85548b0147f4ba6b5e442d137613","modified":1593669248598,"created":1593668581197,"requestId":null,"name":"Test should fail","code":"expect(true).not.to.equal(true);"}
|
||||
{"_id":"ut_97a197104e83454ebf5f4e0dc0ba4bc6","type":"UnitTest","parentId":"uts_7f0f85548b0147f4ba6b5e442d137613","modified":1593669244289,"created":1593668468718,"requestId":null,"name":"Test should succeed","code":"expect(true).to.equal(true);"}
|
@ -0,0 +1,2 @@
|
||||
{"_id":"uts_7f0f85548b0147f4ba6b5e442d137613","type":"UnitTestSuite","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593669651173,"created":1593668430232,"name":"A test suite"}
|
||||
{"_id":"uts_fe901c6565044f00aa620d3fe47f443f","type":"UnitTestSuite","parentId":"wrk_012d4860c7da418a85ffea7406e1292a","modified":1593668662131,"created":1593668662131,"name":"Another suite"}
|
@ -1,2 +1,2 @@
|
||||
{"_id":"wrk_012d4860c7da418a85ffea7406e1292a","type":"Workspace","parentId":null,"modified":1593115261446,"created":1589851906270,"name":"Global Security 1.2","description":"","scope":"spec"}
|
||||
{"_id":"wrk_fa232a1bfad44ed78754492995d8c949","created":1593412428537,"description":"","modified":1593412428537,"name":"tsttestst","parentId":null,"scope":"spec","type":"Workspace"}
|
||||
{"_id":"wrk_012d4860c7da418a85ffea7406e1292a","type":"Workspace","parentId":null,"modified":1593669699121,"created":1589851906270,"name":"Sample Spec 1.2","description":"","scope":"spec"}
|
||||
{"_id":"wrk_0b96eff84c1c4eaa9c6e67ad74bbc85b","type":"Workspace","parentId":null,"modified":1593670005357,"created":1593670005357,"name":"Insomnia Designer","description":"","scope":"spec"}
|
||||
|
@ -14,6 +14,8 @@ describe('gitAdapter()', () => {
|
||||
expect(db?.Request.length).toBe(2);
|
||||
expect(db?.RequestGroup.length).toBe(1);
|
||||
expect(db?.Workspace.length).toBe(1);
|
||||
expect(db?.UnitTestSuite.length).toBe(2);
|
||||
expect(db?.UnitTest.length).toBe(4);
|
||||
});
|
||||
|
||||
it('should seed with git-repo directory with filter', async () => {
|
||||
@ -25,6 +27,8 @@ describe('gitAdapter()', () => {
|
||||
expect(db?.Request.length).toBe(0);
|
||||
expect(db?.RequestGroup.length).toBe(0);
|
||||
expect(db?.Workspace.length).toBe(0);
|
||||
expect(db?.UnitTestSuite.length).toBe(0);
|
||||
expect(db?.UnitTest.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should return null if data directory is invalid', async () => {
|
||||
|
@ -10,10 +10,12 @@ describe('neDbAdapter()', () => {
|
||||
const db = await neDbAdapter(workingDir);
|
||||
|
||||
expect(db?.ApiSpec.length).toBe(2);
|
||||
expect(db?.Environment.length).toBe(4);
|
||||
expect(db?.Request.length).toBe(4);
|
||||
expect(db?.RequestGroup.length).toBe(2);
|
||||
expect(db?.Environment.length).toBe(3);
|
||||
expect(db?.Request.length).toBe(2);
|
||||
expect(db?.RequestGroup.length).toBe(1);
|
||||
expect(db?.Workspace.length).toBe(2);
|
||||
expect(db?.UnitTestSuite.length).toBe(2);
|
||||
expect(db?.UnitTest.length).toBe(4);
|
||||
});
|
||||
|
||||
it('should seed with nedb directory with filter', async () => {
|
||||
@ -21,10 +23,12 @@ describe('neDbAdapter()', () => {
|
||||
const db = await neDbAdapter(workingDir, ['Environment']);
|
||||
|
||||
expect(db?.ApiSpec.length).toBe(0);
|
||||
expect(db?.Environment.length).toBe(4);
|
||||
expect(db?.Environment.length).toBe(3);
|
||||
expect(db?.Request.length).toBe(0);
|
||||
expect(db?.RequestGroup.length).toBe(0);
|
||||
expect(db?.Workspace.length).toBe(0);
|
||||
expect(db?.UnitTestSuite.length).toBe(0);
|
||||
expect(db?.UnitTest.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should return null if data directory is invalid', async () => {
|
||||
|
@ -1,26 +1,28 @@
|
||||
// @flow
|
||||
import type { ApiSpec, BaseModel } from './types';
|
||||
import type { ApiSpec, BaseModel, Environment, UnitTest, UnitTestSuite, Workspace } from './types';
|
||||
import envPaths from 'env-paths';
|
||||
import gitAdapter from './adapters/git-adapter';
|
||||
import neDbAdapter from './adapters/ne-db-adapter';
|
||||
|
||||
export type Database = {|
|
||||
ApiSpec: Array<ApiSpec>,
|
||||
Environment: Array<BaseModel>,
|
||||
Environment: Array<Environment>,
|
||||
Request: Array<BaseModel>,
|
||||
RequestGroup: Array<BaseModel>,
|
||||
Workspace: Array<BaseModel>,
|
||||
Workspace: Array<Workspace>,
|
||||
UnitTestSuite: Array<UnitTestSuite>,
|
||||
UnitTest: Array<UnitTest>,
|
||||
|};
|
||||
|
||||
export function emptyDb(): Database {
|
||||
return {
|
||||
ApiSpec: [],
|
||||
Environment: [],
|
||||
Request: [],
|
||||
RequestGroup: [],
|
||||
Workspace: [],
|
||||
};
|
||||
}
|
||||
export const emptyDb = (): Database => ({
|
||||
ApiSpec: [],
|
||||
Environment: [],
|
||||
Request: [],
|
||||
RequestGroup: [],
|
||||
Workspace: [],
|
||||
UnitTest: [],
|
||||
UnitTestSuite: [],
|
||||
});
|
||||
|
||||
export type DbAdapter = (
|
||||
dir: string,
|
||||
@ -33,11 +35,11 @@ type Options = {
|
||||
filterTypes?: Array<$Keys<Database>>,
|
||||
};
|
||||
|
||||
export async function loadDb({
|
||||
export const loadDb = async ({
|
||||
workingDir,
|
||||
appDataDir,
|
||||
filterTypes,
|
||||
}: Options = {}): Promise<Database> {
|
||||
}: Options = {}): Promise<Database> => {
|
||||
let db = null;
|
||||
|
||||
// try load from git
|
||||
@ -56,4 +58,4 @@ export async function loadDb({
|
||||
|
||||
// return empty db
|
||||
return db || emptyDb();
|
||||
}
|
||||
};
|
||||
|
@ -15,3 +15,31 @@ type BaseApiSpec = {
|
||||
};
|
||||
|
||||
export type ApiSpec = BaseModel & BaseApiSpec;
|
||||
|
||||
type BaseUnitTestSuite = {
|
||||
name: string,
|
||||
};
|
||||
|
||||
export type UnitTestSuite = BaseModel & BaseUnitTestSuite;
|
||||
|
||||
type BaseUnitTest = {
|
||||
name: string,
|
||||
code: string,
|
||||
requestId: string | null,
|
||||
};
|
||||
|
||||
export type UnitTest = BaseModel & BaseUnitTest;
|
||||
|
||||
type BaseEnvironment = {
|
||||
name: string,
|
||||
metaSortKey: number,
|
||||
};
|
||||
|
||||
export type Environment = BaseModel & BaseEnvironment;
|
||||
|
||||
type BaseWorkspace = {
|
||||
name: string,
|
||||
description: string,
|
||||
};
|
||||
|
||||
export type Workspace = BaseModel & BaseWorkspace;
|
||||
|
Loading…
Reference in New Issue
Block a user