Skip to content

Commit 4f3e87e

Browse files
rix0rrrgithub-actions
andauthored
chore: Match.arrEq is not defined for arrays containing undefined (#1589)
So test without them. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --------- Signed-off-by: github-actions <github-actions@github.com> Co-authored-by: github-actions <github-actions@github.com>
1 parent 224a3f3 commit 4f3e87e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/tsconfig/validator.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ describe('Built-in matchers', () => {
9191
});
9292

9393
describe('Match.arrEq', () => {
94+
const arrayEl = anythingExceptUndefined();
95+
9496
test('pass', () => {
9597
fc.assert(
9698
fc.property(
9799
fc
98-
.array(fc.anything({ maxDepth: 0 }))
100+
.array(arrayEl)
99101
.chain((expected) =>
100102
fc.tuple(
101103
fc.constant(expected),
@@ -111,10 +113,10 @@ describe('Built-in matchers', () => {
111113
test('fail', () => {
112114
fc.assert(
113115
fc.property(
114-
fc.uniqueArray(fc.anything(), {
116+
fc.uniqueArray(arrayEl, {
115117
minLength: 1,
116118
}),
117-
fc.array(fc.anything()),
119+
fc.array(arrayEl),
118120
(possible, actualBase) => {
119121
const expected = possible.slice(0, -1);
120122
const actual = [...actualBase, possible.at(-1)];
@@ -229,3 +231,7 @@ describe('Object Validator', () => {
229231
);
230232
});
231233
});
234+
235+
function anythingExceptUndefined() {
236+
return fc.anything().filter((x) => x !== undefined);
237+
}

0 commit comments

Comments
 (0)