Extract helper and lint
This commit is contained in:
parent
5844e282e2
commit
e186a593ff
2 changed files with 61 additions and 37 deletions
|
|
@ -0,0 +1,13 @@
|
|||
import assert from "assert";
|
||||
|
||||
export function assertSetContainsExactly<T>(set: Set<T>, ...values: T[]): void {
|
||||
assert(
|
||||
set.size === values.length &&
|
||||
Array.from(set).every((value) => values.includes(value)),
|
||||
`Expected set to contain only ${values.map((v) => '"' + v + '"').join(", ")}, but it contained ${Array.from(
|
||||
set
|
||||
)
|
||||
.map((v) => '"' + v + '"')
|
||||
.join(", ")}`
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue