Skip to content

Commit b184df4

Browse files
committed
add test
1 parent adf800b commit b184df4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/bloated.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,23 @@ describe('bloated documents', function() {
6969
assert.strictEqual((error as Error).message, 'Schema analysis aborted: Fields count above 4');
7070
}
7171
});
72+
73+
it('aborts after reaching the given limit - nested', async function() {
74+
const documents = [{
75+
field1: {
76+
field2: {
77+
field3: 'abc',
78+
field4: 'bca'
79+
},
80+
field5: 'cab'
81+
}
82+
}];
83+
try {
84+
await getSchema(documents, { distinctFieldsAbortThreshold: 4 });
85+
assert.fail('Analysis did not throw');
86+
} catch (error) {
87+
assert.strictEqual((error as Error).message, 'Schema analysis aborted: Fields count above 4');
88+
}
89+
});
7290
});
7391
});

0 commit comments

Comments
 (0)