wip: migrate to bun

This commit is contained in:
jdalton
2023-09-16 14:47:50 -07:00
parent 2da024c3b4
commit 97d4a2fe19
1052 changed files with 30244 additions and 26856 deletions

28
test/escapeRegExp.spec.ts Normal file
View File

@@ -0,0 +1,28 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import { stubString } from './utils';
import escapeRegExp from '../src/escapeRegExp';
describe('escapeRegExp', () => {
const escaped = '\\^\\$\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\\\',
unescaped = '^$.*+?()[]{}|\\';
it('should escape values', () => {
assert.strictEqual(escapeRegExp(unescaped + unescaped), escaped + escaped);
});
it('should handle strings with nothing to escape', () => {
assert.strictEqual(escapeRegExp('abc'), 'abc');
});
it('should return an empty string for empty values', () => {
const values = [, null, undefined, ''],
expected = lodashStable.map(values, stubString);
const actual = lodashStable.map(values, (value, index) =>
index ? escapeRegExp(value) : escapeRegExp(),
);
assert.deepStrictEqual(actual, expected);
});
});