mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
test(vcs): check Git Log graph options as separate equivalence cases (#5424)
The Git Log graph-equivalence test compares layouts for eight option combinations, each with five fragment configurations. Running all 40 comparisons in one Vitest case exceeded the five-second timeout on shared Linux runners. Give each option combination its own test for histories with and without refs. Each case still compares the complete layout with the dense reference implementation for all five fragment configurations and the same 2,400 commits. Co-authored-by: faysou <893862+faysou@users.noreply.github.com>
This commit is contained in:
@@ -160,24 +160,27 @@ describe("computeGraph lane slots", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("presentLogGraph", () => {
|
||||
describe.each([true, false])("presentLogGraph (refs: %s)", (withRefs) => {
|
||||
const optionCombinations: GraphOptions[] = [false, true].flatMap((collapseLinear) =>
|
||||
[false, true].flatMap((linearizeMerges) =>
|
||||
[false, true].map((longEdges) => ({ collapseLinear, linearizeMerges, longEdges })),
|
||||
),
|
||||
);
|
||||
|
||||
it.each([true, false])("keeps every option and fragment combination unchanged (refs: %s)", (withRefs) => {
|
||||
const commits = history(2400, withRefs);
|
||||
const head = new Set([commitKey(commits[0]!)]);
|
||||
const variants = fragmentVariants(commits);
|
||||
for (const options of optionCombinations)
|
||||
const commits = history(2400, withRefs);
|
||||
const head = new Set([commitKey(commits[0]!)]);
|
||||
const variants = fragmentVariants(commits);
|
||||
|
||||
it.each(optionCombinations)(
|
||||
"keeps fragments equivalent (collapseLinear: $collapseLinear, linearizeMerges: $linearizeMerges, longEdges: $longEdges)",
|
||||
(options) => {
|
||||
for (const [name, fragments] of Object.entries(variants)) {
|
||||
vi.mocked(computeGraph).mockImplementation(real);
|
||||
const got = presentLogGraph(commits, options, fragments, head);
|
||||
vi.mocked(computeGraph).mockImplementation(referenceComputeGraph);
|
||||
const want = presentLogGraph(commits, options, fragments, head);
|
||||
expect(got, `${JSON.stringify(options)} ${name}`).toEqual(want);
|
||||
expect(got, name).toEqual(want);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user