-
Notifications
You must be signed in to change notification settings - Fork 1
/
random.test.js
27 lines (23 loc) · 968 Bytes
/
random.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* eslint-disable no-console */
import { matchString } from '../../src';
import { generateTrueCases, generateWrongCases } from '../utils';
const COUNT = 3000;
const LEN = 1000;
const trueCases = generateTrueCases(COUNT, LEN).map(({ what, where }) => [what, where]);
const wrongCases = generateWrongCases(COUNT, LEN).map(({ what, where }) => [what, where]);
describe(`Random [count is ${COUNT}, length is ${LEN}]`, () => {
describe('TRUE cases', () => {
test.each(trueCases)('fuzzyMatchString(...) === true', (what, where) => {
const result = matchString(what, where);
if (!result) console.log(what, '\r\n', where);
expect(!!result).toBe(true);
});
});
describe('WRONG cases', () => {
test.each(wrongCases)('fuzzyMatchString(...) === false', (what, where) => {
const result = matchString(what, where);
if (result) console.log(what, '\r\n', where, '\r\n', result);
expect(!!result).toBe(false);
});
});
});