1 | "use strict";
|
2 |
|
3 | const
|
4 | Path = require( "path" ),
|
5 | Util = require( "../lib/util" );
|
6 |
|
7 | describe( 'Module util', () => {
|
8 | describe( 'function replaceDotsWithSlashes', () => {
|
9 |
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function check( input, expected ) {
|
18 | const output = Util.replaceDotsWithSlashes( input );
|
19 | expect( output ).toBe( expected.split( '/' ).join( Path.sep ) );
|
20 | }
|
21 |
|
22 | it( 'should not change modules without dots in the name', function () {
|
23 | check( "foo/bar/my-super-module.js", "foo/bar/my-super-module.js" );
|
24 | } );
|
25 | it( 'should change modules with dots in the name', function () {
|
26 | check( "foo/bar/my.super.module.js", "foo/bar/my/super/module.js" );
|
27 | } );
|
28 | it( 'should return non-strings verbatim', function () {
|
29 | expect( Util.replaceDotsWithSlashes( null ) ).toBe( null );
|
30 | expect( Util.replaceDotsWithSlashes( 3.14 ) ).toBe( 3.14 );
|
31 | } );
|
32 | } );
|
33 | } ); |
\ | No newline at end of file |