Skip to content

Commit

Permalink
test: adds test cases from issue and fixes qmhc#330
Browse files Browse the repository at this point in the history
  • Loading branch information
lachieh committed Aug 28, 2024
1 parent 8a0c140 commit 06550ea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/transform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ describe('transform tests', () => {
filePath: './src/child/folder/test.ts',
content: 'import { utilFunction } from "@/utils/test";',
output: "import { utilFunction } from '../../../utils/test';\n"
},
{
description: 'alias as everything, relative import',
aliases: [{ find: /^(.+)$/, replacement: resolve(__dirname, '../src/$1') }],
content: 'import { TestBase } from "test";',
output: "import { TestBase } from './test';\n"
}
]

Expand Down Expand Up @@ -204,6 +210,10 @@ describe('transform tests', () => {
expect(transformCode(options('import { TestNested } from "@/nested/test";')).content).toEqual(
"import { TestNested } from './nested/test';\n"
)

expect(transformCode(options('import { TestBase } from "./test";')).content).toEqual(
"import { TestBase } from './utils/test';\n"
)
})

it('test: transformCode (remove pure imports)', () => {
Expand Down

0 comments on commit 06550ea

Please sign in to comment.