Track parent list name for db items (#1833)

This commit is contained in:
Charis Kyriakou
2022-12-05 10:48:33 +00:00
committed by GitHub
parent 0e744fdb5a
commit 2967777db1
3 changed files with 8 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ export interface LocalDatabaseDbItem {
dateAdded: number;
language: string;
storagePath: string;
parentListName?: string;
}
export interface RootRemoteDbItem {
@@ -76,6 +77,7 @@ export interface RemoteRepoDbItem {
kind: DbItemKind.RemoteRepo;
selected: boolean;
repoFullName: string;
parentListName?: string;
}
export function isRemoteSystemDefinedListDbItem(

View File

@@ -124,6 +124,7 @@ function createRepoItem(
kind: DbItemKind.RemoteRepo,
repoFullName: repo,
selected: !!selected,
parentListName: listName,
};
}
@@ -159,5 +160,6 @@ function createLocalDb(
language: db.language,
storagePath: db.storagePath,
selected: !!selected,
parentListName: listName,
};
}

View File

@@ -100,6 +100,7 @@ describe("db tree creator", () => {
kind: DbItemKind.RemoteRepo,
selected: false,
repoFullName: repo,
parentListName: dbConfig.databases.remote.repositoryLists[0].name,
}),
),
});
@@ -112,6 +113,7 @@ describe("db tree creator", () => {
kind: DbItemKind.RemoteRepo,
selected: false,
repoFullName: repo,
parentListName: dbConfig.databases.remote.repositoryLists[1].name,
}),
),
});
@@ -422,6 +424,7 @@ describe("db tree creator", () => {
dateAdded: db.dateAdded,
language: db.language,
storagePath: db.storagePath,
parentListName: dbConfig.databases.local.lists[0].name,
})),
});
expect(localListNodes[1]).toEqual({
@@ -435,6 +438,7 @@ describe("db tree creator", () => {
dateAdded: db.dateAdded,
language: db.language,
storagePath: db.storagePath,
parentListName: dbConfig.databases.local.lists[1].name,
})),
});
});