Skip to content

Commit

Permalink
test: change to inline snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
wattanx committed May 10, 2024
1 parent b922ba7 commit ff6b75e
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { convertSetup } from "./setupConverter";
import { expect, test } from "vitest";
import { CallExpression, ScriptTarget, SyntaxKind, Project } from "ts-morph";
import { parse } from "@vue/compiler-sfc";
import prettier from "prettier";
import parserTypeScript from "prettier/parser-typescript";
import optionsApi from "../../samples/composition-api.txt?raw";
import { getNodeByKind } from "../helpers/node";

Expand All @@ -25,16 +23,11 @@ test("setup statements", () => {

const statement = convertSetup(callexpression as CallExpression);

const formatedText = prettier.format(statement, {
parser: "typescript",
plugins: [parserTypeScript],
});

const expected = `const { msg, foo } = toRefs(props);
const newMsg = computed(() => msg.value + "- HelloWorld");
const count = ref(0);
`;
expect(statement).toMatchInlineSnapshot(`
"
const { msg, foo } = toRefs(props);
const newMsg = computed(() => msg.value + '- HelloWorld');
expect(formatedText).toBe(expected);
const count = ref(0);"
`);
});

0 comments on commit ff6b75e

Please sign in to comment.