No-op template
This commit is contained in:
34
test/index.ts
Normal file
34
test/index.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { describe, it } from "mocha";
|
||||
import { expect } from "chai";
|
||||
import { transform } from "@babel/core";
|
||||
import { format } from "prettier";
|
||||
import plugin from "../src/index";
|
||||
|
||||
const javascript = (code: TemplateStringsArray) =>
|
||||
transform(code[0], {
|
||||
parserOpts: {
|
||||
plugins: ["decorators-legacy", "typescript"],
|
||||
},
|
||||
plugins: [plugin],
|
||||
})!.code!;
|
||||
|
||||
const canonize = (code: string) => format(code, { parser: "babel" }).trim();
|
||||
|
||||
const equal = (actual: string, expected: string) => {
|
||||
actual = canonize(actual);
|
||||
expected = canonize(expected);
|
||||
expect(actual).to.deep.equal(expected);
|
||||
};
|
||||
|
||||
describe("", () => {
|
||||
it("should do nothing", () => {
|
||||
equal(
|
||||
javascript`
|
||||
class A {}
|
||||
`,
|
||||
/* javascript */ `
|
||||
class A {}
|
||||
`
|
||||
);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user