2023-01-12 19:44:49 +00:00
|
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
|
2022-12-16 02:06:14 +00:00
|
|
|
import splitStringWhitespace from '@/helpers/splitStringWhitespace';
|
|
|
|
|
|
|
|
describe('@/helpers/splitStringWhitespace.ts', function () {
|
|
|
|
it.each([
|
2023-01-12 19:31:47 +00:00
|
|
|
['', []],
|
|
|
|
['hello world', ['hello', 'world']],
|
|
|
|
[' hello world ', ['hello', 'world']],
|
|
|
|
['hello123 world 123 $$ s ', ['hello123', 'world', '123', '$$', 's']],
|
|
|
|
['hello world! how are you?', ['hello', 'world!', 'how', 'are', 'you?']],
|
|
|
|
['hello "foo bar baz" world', ['hello', 'foo bar baz', 'world']],
|
|
|
|
['hello "foo \\"bar bar \\" baz" world', ['hello', 'foo "bar bar " baz', 'world']],
|
|
|
|
['hello "foo "bar baz" baz" world', ['hello', 'foo bar', 'baz baz', 'world']],
|
2022-12-16 02:06:14 +00:00
|
|
|
])('should handle string: %s', function (input, output) {
|
|
|
|
expect(splitStringWhitespace(input)).toStrictEqual(output);
|
|
|
|
});
|
|
|
|
});
|