Skip to content

Commit

Permalink
test: Add tests to defineComponentImportConverter.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
inouetakuya committed May 6, 2024
1 parent 005dcbe commit a28d604
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ describe("convertDefineComponentImport", () => {
});
});

describe("when only defineComponent is imported", () => {
const source = `<script>
import { defineComponent } from 'vue';
export default defineComponent({
name: 'HelloWorld',
})
</script>`;

it("returns blank", () => {
const output = parseScript(source);
const expected = "";

expect(output).toBe(expected);
});
});

describe("when defineNuxtComponent is imported", () => {
const source = `<script>
import { defineNuxtComponent, ref } from '#imports';
Expand All @@ -63,4 +80,21 @@ describe("convertDefineComponentImport", () => {
expect(output).toBe(expected);
});
});

describe("when only defineNuxtComponent is imported", () => {
const source = `<script>
import { defineNuxtComponent } from '#imports';
export default defineNuxtComponent({
name: 'HelloWorld',
})
</script>`;

it("returns blank", () => {
const output = parseScript(source);
const expected = "";

expect(output).toBe(expected);
});
});
});

0 comments on commit a28d604

Please sign in to comment.