2021-08-10 00:27:23 +00:00
|
|
|
import { expect } from 'chai'
|
2021-08-11 20:28:38 +00:00
|
|
|
import { TrsnsformPlugin } from '../src/global-imports/transform'
|
2021-08-10 00:27:23 +00:00
|
|
|
|
|
|
|
describe('module:global-imports:build', () => {
|
|
|
|
const { transform } = TrsnsformPlugin.raw({ ref: 'vue' })
|
|
|
|
|
|
|
|
it('should correct inject', () => {
|
|
|
|
expect(transform('const a = ref(0)', ''))
|
|
|
|
.to.equal('import { ref } from \'vue\';const a = ref(0)')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should ignore imported', () => {
|
|
|
|
expect(transform('import { ref } from "foo";const a = ref(0)', ''))
|
|
|
|
.to.equal('import { ref } from "foo";const a = ref(0)')
|
|
|
|
})
|
|
|
|
})
|