Renaming and smaller merge comments

This commit is contained in:
Nora
2023-05-25 10:02:22 +00:00
parent 2e12b8d756
commit 250089a9e3
4 changed files with 13 additions and 14 deletions

View File

@@ -163,7 +163,7 @@ export class DbConfigStore extends DisposableObject {
// Remove duplicates from the list of repositories.
const newRepositoriesList = [
...new Set([...new Set(parent.repositories), ...new Set(repoNwoList)]),
...new Set([...parent.repositories, ...repoNwoList]),
];
parent.repositories = newRepositoriesList.slice(0, 1000);

View File

@@ -189,7 +189,7 @@ export class DbPanel extends DisposableObject {
);
if (parentList) {
this.truncatedReposNote(truncatedRepositories, parentList);
this.reportAnyTruncatedRepos(truncatedRepositories, parentList);
}
}
@@ -369,9 +369,7 @@ export class DbPanel extends DisposableObject {
},
);
if (!codeSearchLanguage) {
// We don't need to display a warning pop-up in this case, since the user just escaped out of the operation.
// We set 'true' to make this a silent exception.
throw new UserCancellationException("No language selected", true);
return;
}
const codeSearchQuery = await window.showInputBox({
@@ -408,12 +406,12 @@ export class DbPanel extends DisposableObject {
const truncatedRepositories =
await this.dbManager.addNewRemoteReposToList(repositories, listName);
this.truncatedReposNote(truncatedRepositories, listName);
this.reportAnyTruncatedRepos(truncatedRepositories, listName);
},
);
}
private truncatedReposNote(
private reportAnyTruncatedRepos(
truncatedRepositories: string[],
listName: string,
) {

View File

@@ -262,7 +262,7 @@ describe("db config store", () => {
});
// Add
await configStore.addRemoteReposToList(
const response = await configStore.addRemoteReposToList(
["owner/repo1", "owner/repo2"],
"list1",
);
@@ -278,11 +278,12 @@ describe("db config store", () => {
name: "list1",
repositories: ["owner/repo1", "owner/repo2"],
});
expect(response).toEqual([]);
configStore.dispose();
});
it("should add no more than 1000 repositories to a remote list using #addRemoteReposToList", async () => {
it("should add no more than 1000 repositories to a remote list when adding multiple repos", async () => {
// Initial set up
const dbConfig = createDbConfig({
remoteLists: [
@@ -296,7 +297,7 @@ describe("db config store", () => {
const configStore = await initializeConfig(dbConfig, configPath, app);
// Add
const reponse = await configStore.addRemoteReposToList(
const response = await configStore.addRemoteReposToList(
[...Array(1001).keys()].map((i) => `owner/db${i}`),
"list1",
);
@@ -311,12 +312,12 @@ describe("db config store", () => {
expect(updatedRemoteDbs.repositoryLists[0].repositories).toHaveLength(
1000,
);
expect(reponse).toEqual(["owner/db1000"]);
expect(response).toEqual(["owner/db1000"]);
configStore.dispose();
});
it("should add no more than 1000 repositories to a remote list using #addRemoteRepo", async () => {
it("should add no more than 1000 repositories to a remote list when adding one repo", async () => {
// Initial set up
const dbConfig = createDbConfig({
remoteLists: [

View File

@@ -115,7 +115,7 @@ describe("db manager", () => {
});
});
it("should return truncated repos when adding to a user defined list using #addNewRemoteReposToList", async () => {
it("should return truncated repos when adding multiple repos to a user defined list", async () => {
const dbConfig: DbConfig = createDbConfig({
remoteLists: [
{
@@ -135,7 +135,7 @@ describe("db manager", () => {
expect(response).toEqual(["owner2/repo2"]);
});
it("should return truncated repos when adding to a user defined list using #addNewRemoteRepo", async () => {
it("should return truncated repos when adding one repo to a user defined list", async () => {
const dbConfig: DbConfig = createDbConfig({
remoteLists: [
{