File size: 705 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { cssNameFromFilename } = require( '../util' );

describe( 'cssNameFromFilename()', () => {
	test( 'Transforms static string', () => {
		expect( cssNameFromFilename( 'static.js' ) ).toBe( 'static.css' );
	} );

	test( 'Passes `undefined` through', () => {
		expect( cssNameFromFilename() ).toBeUndefined();
	} );

	test( 'Handles templates', () => {
		expect( cssNameFromFilename( '[name].[hash].js' ) ).toBe( '[name].[hash].css' );
	} );

	test( 'Maintains query string', () => {
		expect( cssNameFromFilename( 'static.js?query=string' ) ).toBe( 'static.css?query=string' );
	} );

	test( 'Returns other extensions untouched 😬', () => {
		expect( 'static.jsx' ).toBe( 'static.jsx' );
	} );
} );