From fccccb6f0b47fecb1b292eb77bb14751f5ef965d Mon Sep 17 00:00:00 2001 From: wattanx Date: Tue, 30 Apr 2024 21:35:46 +0900 Subject: [PATCH] test: change to inline snapshot --- .../src/lib/convertSrc.test.ts | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/packages/vue-script-setup-converter/src/lib/convertSrc.test.ts b/packages/vue-script-setup-converter/src/lib/convertSrc.test.ts index 5c1bc94..bd92169 100644 --- a/packages/vue-script-setup-converter/src/lib/convertSrc.test.ts +++ b/packages/vue-script-setup-converter/src/lib/convertSrc.test.ts @@ -1,8 +1,8 @@ -import { expect, describe, it } from "vitest"; -import { convertSrc } from "./convertSrc"; +import { expect, describe, it } from 'vitest'; +import { convertSrc } from './convertSrc'; -describe("snapshot", () => { - it("lang=js", () => { +describe('snapshot', () => { + it('lang=js', () => { const output = convertSrc(``); - expect(output).toBe( + expect(output).toMatchInlineSnapshot( ` -import { defineComponent, toRefs, computed } from 'vue'; -type Props = { msg?: string; }; const props = withDefaults(defineProps(), { msg: 'HelloWorld' }); - -const { msg } = toRefs(props); -const newMsg = computed(() => msg.value + '- HelloWorld'); -` + " + import { defineComponent, toRefs, computed } from 'vue'; + type Props = { msg?: string; }; const props = withDefaults(defineProps(), { msg: 'HelloWorld' }); + + const { msg } = toRefs(props); + const newMsg = computed(() => msg.value + '- HelloWorld'); + " + ` ); }); @@ -150,13 +152,15 @@ export default defineComponent({ } }) `); - expect(output).toBe( + expect(output).toMatchInlineSnapshot( ` -import { defineComponent, computed } from 'vue'; -type Props = { msg?: string; }; const props = withDefaults(defineProps(), { msg: 'HelloWorld' }); + " + import { defineComponent, computed } from 'vue'; + type Props = { msg?: string; }; const props = withDefaults(defineProps(), { msg: 'HelloWorld' }); -const newMsg = computed(() => props.msg + '- HelloWorld'); -` + const newMsg = computed(() => props.msg + '- HelloWorld'); + " + ` ); - }) + }); });