658 B20 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import splitPath from './splitPath';
9
10describe('splitPath', () => {
11 test('splits path into dirname and basename', () => {
12 expect(splitPath('')).toEqual(['', '']);
13 expect(splitPath('foo')).toEqual(['', 'foo']);
14 expect(splitPath('/foo')).toEqual(['', 'foo']);
15 expect(splitPath('/foo/bar')).toEqual(['/foo', 'bar']);
16 expect(splitPath('foo/bar')).toEqual(['foo', 'bar']);
17 expect(splitPath('foo/bar/baz')).toEqual(['foo/bar', 'baz']);
18 });
19});
20