Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[set.js] improve tests
  • Loading branch information
mikeharder committed Jul 31, 2025
commit dbc2b4583cdf0babc176c8f643833ede1702ff48
13 changes: 10 additions & 3 deletions .github/shared/test/set.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// @ts-check

import { describe, expect, it } from "vitest";
Expand All @@ -6,6 +6,7 @@
describe("set", () => {
it.each([
[[], [], []],
[[1, 2, 3], [], []],
[
[1, 2, 3],
[2, 3, 4],
Expand All @@ -25,11 +26,17 @@
])(
"intersect(%o, %o, %o)",
async (
/** @type {(string|number)[]} */ setA,
/** @type {(string|number)[]} */ setB,
/** @type {(string|number)[]} */ a,
/** @type {(string|number)[]} */ b,
/** @type {(string|number)[]} */ result,
) => {
expect(intersect(new Set(setA), new Set(setB))).toEqual(new Set(result));
const setA = new Set(a);
const setB = new Set(b);
const setResult = new Set(result);

// Check both orders, result should be same
expect(intersect(setA, setB)).toEqual(setResult);
expect(intersect(setB, setA)).toEqual(setResult);
},
);
});
Loading