This repository was archived by the owner on Jul 13, 2020. It is now read-only.
File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ describe('System', function () {
66
66
67
67
beforeEach ( function ( ) {
68
68
System . baseURL = 'http://example.org/a/' ;
69
+ // required to stop paths leaking between tests (wrecks order for example)
70
+ delete System . paths [ 'path/*' ] ;
71
+ delete System . paths [ 'path/specific/*' ] ;
72
+ delete System . paths [ 'path/best/*' ] ;
69
73
} ) ;
70
74
71
75
it ( 'should resolve paths' , function ( ) {
@@ -81,5 +85,20 @@ describe('System', function () {
81
85
. to . equal ( 'http://example.org/test/test.js' ) ;
82
86
} ) ;
83
87
88
+ it ( 'should show precedence to longer wilcard paths' , function ( ) {
89
+ // most specific path first to illustrate not last-case-wins
90
+ System . paths [ 'path/specific/*' ] = '/best/*.js' ;
91
+ System . paths [ 'path/*' ] = '/test/*.js' ;
92
+ expect ( System . locate ( { name : 'path/specific/test' } ) )
93
+ . to . equal ( 'http://example.org/best/test.js' ) ;
94
+ } ) ;
95
+
96
+ it ( 'should show precedence to last wilcard path in case of tie' , function ( ) {
97
+ System . paths [ 'path/*/test' ] = '/test/*.js' ;
98
+ System . paths [ 'path/best/*' ] = '/best/*.js' ;
99
+ expect ( System . locate ( { name : 'path/best/test' } ) )
100
+ . to . equal ( 'http://example.org/best/test.js' ) ;
101
+ } ) ;
102
+
84
103
} ) ;
85
104
} ) ;
You can’t perform that action at this time.
0 commit comments