File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ export const smartRequire = modulePath => {
9
9
return require ( modulePath )
10
10
}
11
11
12
- export const joinURLPath = ( ...paths ) => paths . join ( '/' ) . replace ( / \/ \/ / g, '/' )
12
+ export const joinURLPath = ( ...paths ) =>
13
+ paths . join ( '/' ) . replace ( / (?< ! : ) \/ \/ / g, '/' )
Original file line number Diff line number Diff line change
1
+ import { joinURLPath } from './util'
2
+
3
+ describe ( 'util' , ( ) => {
4
+ describe ( '#joinURLPath' , ( ) => {
5
+ it ( 'should join paths with relative public path' , ( ) => {
6
+ expect ( joinURLPath ( 'public' , 'style.css' ) ) . toBe ( 'public/style.css' )
7
+ expect ( joinURLPath ( 'public/' , 'style.css' ) ) . toBe ( 'public/style.css' )
8
+ } )
9
+ it ( 'should join paths with absolute public path' , ( ) => {
10
+ const publicPath = 'http://localhost:3001/public'
11
+
12
+ expect ( joinURLPath ( publicPath , 'style.css' ) ) . toBe (
13
+ `${ publicPath } /style.css` ,
14
+ )
15
+ expect ( joinURLPath ( `${ publicPath } /` , 'style.css' ) ) . toBe (
16
+ `${ publicPath } /style.css` ,
17
+ )
18
+ } )
19
+ } )
20
+ } )
You can’t perform that action at this time.
0 commit comments