Skip to content

Commit e521112

Browse files
authored
Add db config factory function and use it in tests (#1859)
1 parent 216faee commit e521112

File tree

2 files changed

+128
-227
lines changed

2 files changed

+128
-227
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {
2+
DbConfig,
3+
ExpandedDbItem,
4+
LocalDatabase,
5+
LocalList,
6+
RemoteRepositoryList,
7+
SelectedDbItem,
8+
} from "../../src/databases/config/db-config";
9+
10+
export function createDbConfig({
11+
remoteLists = [],
12+
remoteOwners = [],
13+
remoteRepos = [],
14+
localLists = [],
15+
localDbs = [],
16+
selected = undefined,
17+
expanded = [],
18+
}: {
19+
remoteLists?: RemoteRepositoryList[];
20+
remoteOwners?: string[];
21+
remoteRepos?: string[];
22+
localLists?: LocalList[];
23+
localDbs?: LocalDatabase[];
24+
selected?: SelectedDbItem;
25+
expanded?: ExpandedDbItem[];
26+
} = {}): DbConfig {
27+
return {
28+
databases: {
29+
remote: {
30+
repositoryLists: remoteLists,
31+
owners: remoteOwners,
32+
repositories: remoteRepos,
33+
},
34+
local: {
35+
lists: localLists,
36+
databases: localDbs,
37+
},
38+
},
39+
expanded,
40+
selected,
41+
};
42+
}

0 commit comments

Comments
 (0)