Nuxt/packages/global-imports/test/build.test.ts
Anthony Fu b2b4c64807
feat: auto global imports (#410)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2021-08-10 02:27:23 +02:00

17 lines
526 B
TypeScript

import { expect } from 'chai'
import { TrsnsformPlugin } from '../src/transform'
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)')
})
})