Delete tests for determineSelection
This commit is contained in:
@@ -831,93 +831,6 @@ describe("QueryHistoryManager", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("determineSelection", () => {
|
||||
const singleItem = "a";
|
||||
const multipleItems = ["b", "c", "d"];
|
||||
|
||||
it("should get the selection from parameters", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
const selection = (queryHistoryManager as any).determineSelection(
|
||||
singleItem,
|
||||
multipleItems,
|
||||
);
|
||||
expect(selection).toEqual({
|
||||
finalSingleItem: singleItem,
|
||||
finalMultiSelect: multipleItems,
|
||||
});
|
||||
});
|
||||
|
||||
it("should get the selection when single selection is empty", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
const selection = (queryHistoryManager as any).determineSelection(
|
||||
undefined,
|
||||
multipleItems,
|
||||
);
|
||||
expect(selection).toEqual({
|
||||
finalSingleItem: multipleItems[0],
|
||||
finalMultiSelect: multipleItems,
|
||||
});
|
||||
});
|
||||
|
||||
it("should get the selection when multi-selection is empty", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
const selection = (queryHistoryManager as any).determineSelection(
|
||||
singleItem,
|
||||
undefined,
|
||||
);
|
||||
expect(selection).toEqual({
|
||||
finalSingleItem: singleItem,
|
||||
finalMultiSelect: [singleItem],
|
||||
});
|
||||
});
|
||||
|
||||
it("should get the selection from the treeView when both selections are empty", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
const p = new Promise<void>((done) => {
|
||||
queryHistoryManager!.treeView.onDidChangeSelection((s) => {
|
||||
if (s.selection[0] !== allHistory[1]) {
|
||||
return;
|
||||
}
|
||||
const selection = (queryHistoryManager as any).determineSelection(
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
expect(selection).toEqual({
|
||||
finalSingleItem: allHistory[1],
|
||||
finalMultiSelect: [allHistory[1]],
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// I can't explain why, but the first time the onDidChangeSelection event fires, the selection is
|
||||
// not correct (it is inexplicably allHistory[2]). So we fire the event a second time to get the
|
||||
// correct selection.
|
||||
await queryHistoryManager.treeView.reveal(allHistory[0], {
|
||||
select: true,
|
||||
});
|
||||
await queryHistoryManager.treeView.reveal(allHistory[1], {
|
||||
select: true,
|
||||
});
|
||||
await p;
|
||||
});
|
||||
|
||||
it.skip("should get the selection from the treeDataProvider when both selections and the treeView are empty", async () => {
|
||||
queryHistoryManager = await createMockQueryHistory(allHistory);
|
||||
await queryHistoryManager.treeView.reveal(allHistory[1], {
|
||||
select: true,
|
||||
});
|
||||
const selection = (queryHistoryManager as any).determineSelection(
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
expect(selection).toEqual({
|
||||
finalSingleItem: allHistory[1],
|
||||
finalMultiSelect: [allHistory[1]],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Local Queries", () => {
|
||||
describe("findOtherQueryToCompare", () => {
|
||||
it("should find the second query to compare when one is selected", async () => {
|
||||
|
||||
Reference in New Issue
Block a user