Skip to content

Commit

Permalink
test: add tests that reproduce #80
Browse files Browse the repository at this point in the history
  • Loading branch information
ony3000 committed Dec 7, 2024
1 parent e190f16 commit 384c7ae
Show file tree
Hide file tree
Showing 28 changed files with 1,176 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
<div />
\`\`\`
"
`;

exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;

exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
<div />
\`\`\`
"
`;

exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;
59 changes: 59 additions & 0 deletions tests/v2-test/markdown/issue-80/__snapshots__/ideal.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
<div />
\`\`\`
"
`;

exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;

exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
<div />
\`\`\`
"
`;

exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'(1) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
<div />
\`\`\`
"
`;

exports[`'(2) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(3) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;

exports[`'(4) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
<div />
\`\`\`
"
`;

exports[`'(5) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(6) This plugin doesn\\'t support markdown parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;
13 changes: 13 additions & 0 deletions tests/v2-test/markdown/issue-80/absolute.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { baseOptions } from 'test-settings';

import { thisPlugin, testSnapshotEach } from '../../adaptor';
import { fixtures } from './fixtures';

const options = {
...baseOptions,
plugins: [thisPlugin],
parser: 'markdown',
endingPosition: 'absolute',
};

testSnapshotEach(fixtures, options);
78 changes: 78 additions & 0 deletions tests/v2-test/markdown/issue-80/fixtures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import type { Fixture } from 'test-settings';

export const fixtures: Omit<Fixture, 'output'>[] = [
{
name: "(1) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`jsx
<div />;
\`\`\`
`,
options: {},
},
{
name: "(2) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`jsx
import foo from 'foo'
<div />
\`\`\`
`,
options: {},
},
{
name: "(3) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`jsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
`,
options: {
printWidth: 60,
},
},
{
name: "(4) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`tsx
<div />;
\`\`\`
`,
options: {},
},
{
name: "(5) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`tsx
import foo from 'foo'
<div />
\`\`\`
`,
options: {},
},
{
name: "(6) This plugin doesn't support markdown parser, so it leaves Prettier's output as is.",
input: `
\`\`\`tsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
`,
options: {
printWidth: 60,
},
},
];
13 changes: 13 additions & 0 deletions tests/v2-test/markdown/issue-80/ideal.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { baseOptions } from 'test-settings';

import { thisPlugin, testSnapshotEach } from '../../adaptor';
import { fixtures } from './fixtures';

const options = {
...baseOptions,
plugins: [thisPlugin],
parser: 'markdown',
endingPosition: 'absolute-with-indent',
};

testSnapshotEach(fixtures, options);
13 changes: 13 additions & 0 deletions tests/v2-test/markdown/issue-80/relative.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { baseOptions } from 'test-settings';

import { thisPlugin, testSnapshotEach } from '../../adaptor';
import { fixtures } from './fixtures';

const options = {
...baseOptions,
plugins: [thisPlugin],
parser: 'markdown',
endingPosition: 'relative',
};

testSnapshotEach(fixtures, options);
59 changes: 59 additions & 0 deletions tests/v2-test/mdx/issue-80/__snapshots__/absolute.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`'(1) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
<div />
\`\`\`
"
`;

exports[`'(2) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(3) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`jsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;

exports[`'(4) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
<div />
\`\`\`
"
`;

exports[`'(5) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
import foo from "foo";
<div />;
\`\`\`
"
`;

exports[`'(6) This plugin doesn\\'t support mdx parser, so it leaves Prettier\\'s output as is.' > expectation 1`] = `
"\`\`\`tsx
export function Foo({ children }) {
return (
<div className="lorem ipsum dolor sit amet consectetur adipiscing elit proin ex massa hendrerit eu posuere eu volutpat id neque pellentesque">
{children}
</div>
);
}
\`\`\`
"
`;
Loading

0 comments on commit 384c7ae

Please sign in to comment.