mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-14 02:17:06 +00:00
typegen: give the isInlineStruct timing test room on a loaded machine
The bound was 100 ms and the test failed once inside the full suite. The regex it guards against needs about 9 s on that input and the linear check about 1 ms, so 1 s still fails on the regex and does not fail on a busy runner.
This commit is contained in:
1 parent
6ba4cf7580
commit
6f0a5a6805
1 file changed
+2
-1
@@ -48,9 +48,10 @@ describe('isInlineStruct', (): void => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('is linear on input that made the regex backtrack', (): void => {
|
it('is linear on input that made the regex backtrack', (): void => {
|
||||||
|
// /^{.+:.+}/ needs ~9s here, the linear check ~1ms; 1s leaves room for a loaded machine
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
|
|
||||||
expect(isInlineStruct(`{{${'a:'.repeat(100_000)}`)).toBe(false);
|
expect(isInlineStruct(`{{${'a:'.repeat(100_000)}`)).toBe(false);
|
||||||
expect(Date.now() - start < 100).toBe(true);
|
expect(Date.now() - start < 1000).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user