File tree 1 file changed +25
-0
lines changed
packages/ipfs-unixfs-importer/test
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-env mocha */
2
+
3
+ import { expect } from 'aegir/utils/chai.js'
4
+ import toPathComponents from '../src/utils/to-path-components.js'
5
+
6
+ describe ( 'toPathComponents' , ( ) => {
7
+ it ( 'splits on unescaped "/" characters' , ( ) => {
8
+ const path = 'foo/bar/baz'
9
+ const components = toPathComponents ( path )
10
+ expect ( components . length ) . to . eq ( 3 )
11
+ } )
12
+
13
+ it ( 'does not split on escaped "/" characters' , ( ) => {
14
+ const path = 'foo\\/bar/baz'
15
+ const components = toPathComponents ( path )
16
+ expect ( components . length ) . to . eq ( 2 )
17
+ } )
18
+
19
+ // see https://github.com/ipfs/js-ipfs-unixfs/issues/177 for context
20
+ it ( 'does not split on "^" characters' , ( ) => {
21
+ const path = 'foo/bar^baz^^qux'
22
+ const components = toPathComponents ( path )
23
+ expect ( components . length ) . to . eq ( 2 )
24
+ } )
25
+ } )
You can’t perform that action at this time.
0 commit comments