@@ -3,40 +3,42 @@ import Path from '../../../src/shared/models/Path';
33describe ( 'Path tests' , ( ) => {
44 test ( `should return correct components for a simple web path` , ( ) => {
55 const path = new Path ( '/web-folder/assets/service-worker.js' ) ;
6- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
7- expect ( path . getFullPath ( ) ) . toBe ( '/web-folder/assets/service-worker.js' ) ;
6+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
7+ expect ( path . _getFullPath ( ) ) . toBe ( '/web-folder/assets/service-worker.js' ) ;
88 } ) ;
99
1010 test ( `should return correct components for a file-based path` , ( ) => {
1111 const path = new Path ( 'file:///c:/web-folder/assets/service-worker.js' ) ;
12- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
13- expect ( path . getFullPath ( ) ) . toBe (
12+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
13+ expect ( path . _getFullPath ( ) ) . toBe (
1414 'file:///c:/web-folder/assets/service-worker.js' ,
1515 ) ;
1616 } ) ;
1717
1818 test ( `should return case-sensitive correct components for a file-based path` , ( ) => {
1919 const path = new Path ( '/WeB-FoLdEr/AsSeTs/SeRvIcE-WoRkEr.js' ) ;
20- expect ( path . getFileName ( ) ) . toBe ( 'SeRvIcE-WoRkEr.js' ) ;
21- expect ( path . getFullPath ( ) ) . toBe ( '/WeB-FoLdEr/AsSeTs/SeRvIcE-WoRkEr.js' ) ;
20+ expect ( path . _getFileName ( ) ) . toBe ( 'SeRvIcE-WoRkEr.js' ) ;
21+ expect ( path . _getFullPath ( ) ) . toBe ( '/WeB-FoLdEr/AsSeTs/SeRvIcE-WoRkEr.js' ) ;
2222 } ) ;
2323
2424 test ( `should return correct components for a double-extension path` , ( ) => {
2525 const path = new Path ( '/web-folder/assets/service-worker.js.php' ) ;
26- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js.php' ) ;
27- expect ( path . getFullPath ( ) ) . toBe ( '/web-folder/assets/service-worker.js.php' ) ;
26+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js.php' ) ;
27+ expect ( path . _getFullPath ( ) ) . toBe (
28+ '/web-folder/assets/service-worker.js.php' ,
29+ ) ;
2830 } ) ;
2931
3032 test ( `should return correct components for a root-relative path` , ( ) => {
3133 const path = new Path ( '/service-worker.js' ) ;
32- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
33- expect ( path . getFullPath ( ) ) . toBe ( '/service-worker.js' ) ;
34+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
35+ expect ( path . _getFullPath ( ) ) . toBe ( '/service-worker.js' ) ;
3436 } ) ;
3537
3638 test ( `should return correct components for an absolute web path` , ( ) => {
3739 const path = new Path ( 'https://site.com/web-folder/service-worker.js' ) ;
38- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
39- expect ( path . getFullPath ( ) ) . toBe (
40+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
41+ expect ( path . _getFullPath ( ) ) . toBe (
4042 'https://site.com/web-folder/service-worker.js' ,
4143 ) ;
4244 } ) ;
@@ -45,21 +47,15 @@ describe('Path tests', () => {
4547 const path = new Path (
4648 'https://site.com/web-folder/service-worker.js?appId=12345' ,
4749 ) ;
48- expect ( path . getFullPath ( ) ) . toBe (
49- 'https://site.com/web-folder/service-worker.js?appId=12345' ,
50- ) ;
51- } ) ;
52- test ( `should include query string in path with query` , ( ) => {
53- const path = new Path (
50+ expect ( path . _getFullPath ( ) ) . toBe (
5451 'https://site.com/web-folder/service-worker.js?appId=12345' ,
5552 ) ;
56- expect ( path . getFileNameWithQuery ( ) ) . toBe ( 'service-worker.js?appId=12345' ) ;
5753 } ) ;
5854
5955 test ( `should not include query string in path filename` , ( ) => {
6056 const path = new Path (
6157 'https://site.com/web-folder/service-worker.js?appId=12345' ,
6258 ) ;
63- expect ( path . getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
59+ expect ( path . _getFileName ( ) ) . toBe ( 'service-worker.js' ) ;
6460 } ) ;
6561} ) ;
0 commit comments