55
66import testSubject from '#lib/change-ext'
77import formatExt from '#lib/format-ext'
8- import pathToFileURL from '#lib/path-to-file-url'
98import type { EmptyString } from '@flex-development/pathe'
109
1110describe ( 'unit:lib/changeExt' , ( ) => {
1211 it . each < [ URL , string ] > ( [
13- [ pathToFileURL ( ' /change-ext') , 'mjs' ] ,
14- [ pathToFileURL ( ' /change-ext.') , '.mjs' ] ,
15- [ pathToFileURL ( ' /change-ext.min.cjs') , '.mjs' ] ,
16- [ pathToFileURL ( ' /change-ext.mts') , 'd.mts' ]
17- ] ) ( 'should return `input` with changed extension (%# )' , ( input , ext ) => {
12+ [ new URL ( 'file:// /change-ext') , 'mjs' ] ,
13+ [ new URL ( 'file:// /change-ext.') , '.mjs' ] ,
14+ [ new URL ( 'file:// /change-ext.min.cjs') , '.mjs' ] ,
15+ [ new URL ( 'file:// /change-ext.mts') , 'd.mts' ]
16+ ] ) ( 'should return `input` with changed extension (%j, %j )' , ( input , ext ) => {
1817 // Act
1918 const result = testSubject ( input , ext )
2019
@@ -24,10 +23,10 @@ describe('unit:lib/changeExt', () => {
2423 expect ( result ) . to . have . property ( 'href' ) . endWith ( result . pathname )
2524 } )
2625
27- it . each < [ URL , ( EmptyString | null | undefined ) ? ] > ( [
28- [ pathToFileURL ( ' /change-ext.cjs') , '' ] ,
29- [ pathToFileURL ( ' /change-ext.mjs') , null ]
30- ] ) ( 'should return `input` without extension (%# )' , ( input , ext ) => {
26+ it . each < [ URL , EmptyString | null ] > ( [
27+ [ new URL ( 'file:// /change-ext.cjs') , '' ] ,
28+ [ new URL ( 'file:// /change-ext.mjs') , null ]
29+ ] ) ( 'should return `input` without extension (%j, %j )' , ( input , ext ) => {
3130 // Act
3231 const result = testSubject ( input , ext )
3332
0 commit comments