pdf-to-markdown/core/test/support/stringFunctions.test.ts
2021-03-29 07:24:20 +02:00

15 lines
525 B
TypeScript

import { filterOutDigits, extractNumbers } from 'src/support/stringFunctions';
test('filterOutDigits', async () => {
expect(filterOutDigits('')).toEqual('');
expect(filterOutDigits('a b c')).toEqual('a b c');
expect(filterOutDigits('a1b 2c 3')).toEqual('ab c ');
});
test('extractNumbers', async () => {
expect(extractNumbers('')).toEqual([]);
expect(extractNumbers('a b c')).toEqual([]);
expect(extractNumbers('a1b 2c 3')).toEqual([1, 2, 3]);
expect(extractNumbers('a12 21 304')).toEqual([12, 21, 304]);
});