Rename + expand existing helper for shuffling lists
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
createMockLocalQueryInfo,
|
||||
createMockQueryWithResults,
|
||||
} from "../../../factories/query-history/local-query-history-item";
|
||||
import { shuffleHistoryItems } from "../../utils/query-history-helpers";
|
||||
import { shuffle } from "../../utils/list-helpers";
|
||||
import { createMockVariantAnalysisHistoryItem } from "../../../factories/query-history/variant-analysis-history-item";
|
||||
import type { VariantAnalysisHistoryItem } from "../../../../src/query-history/variant-analysis-history-item";
|
||||
import { QueryStatus } from "../../../../src/query-history/query-status";
|
||||
@@ -121,10 +121,7 @@ describe("HistoryTreeDataProvider", () => {
|
||||
variantAnalysisStatus: VariantAnalysisStatus.InProgress,
|
||||
}),
|
||||
];
|
||||
allHistory = shuffleHistoryItems([
|
||||
...localQueryHistory,
|
||||
...variantAnalysisHistory,
|
||||
]);
|
||||
allHistory = shuffle([...localQueryHistory, ...variantAnalysisHistory]);
|
||||
|
||||
labelProvider = new HistoryItemLabelProvider({
|
||||
format: "",
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
createMockLocalQueryInfo,
|
||||
createMockQueryWithResults,
|
||||
} from "../../../factories/query-history/local-query-history-item";
|
||||
import { shuffleHistoryItems } from "../../utils/query-history-helpers";
|
||||
import { shuffle } from "../../utils/list-helpers";
|
||||
import { createMockVariantAnalysisHistoryItem } from "../../../factories/query-history/variant-analysis-history-item";
|
||||
import type { VariantAnalysisHistoryItem } from "../../../../src/query-history/variant-analysis-history-item";
|
||||
import { QueryStatus } from "../../../../src/query-history/query-status";
|
||||
@@ -138,10 +138,7 @@ describe("QueryHistoryManager", () => {
|
||||
variantAnalysisStatus: VariantAnalysisStatus.InProgress,
|
||||
}),
|
||||
];
|
||||
allHistory = shuffleHistoryItems([
|
||||
...localQueryHistory,
|
||||
...variantAnalysisHistory,
|
||||
]);
|
||||
allHistory = shuffle([...localQueryHistory, ...variantAnalysisHistory]);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export function shuffle<T>(xs: T[]): T[] {
|
||||
return xs.sort(() => Math.random() - 0.5);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import type { QueryHistoryInfo } from "../../../src/query-history/query-history-info";
|
||||
|
||||
export function shuffleHistoryItems(history: QueryHistoryInfo[]) {
|
||||
return history.sort(() => Math.random() - 0.5);
|
||||
}
|
||||
Reference in New Issue
Block a user