Skip to content

Commit

Permalink
tests: convert to migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyjosephprice committed Oct 30, 2024
1 parent ff4c4d2 commit 3aae9ab
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
8 changes: 4 additions & 4 deletions __tests__/migration/emphasis.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('migrating emphasis', () => {
it('trims whitespace surrounding phrasing content (emphasis, strong, etc)', () => {
const md = '** bold ** and _ italic _ and *** bold italic ***';

const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"**bold** and *italic* and ***bold italic***
"
Expand All @@ -14,7 +14,7 @@ describe('migrating emphasis', () => {
it('moves whitespace surrounding phrasing content (emphasis, strong, etc) to the appropriate place', () => {
const md = '**bold **and also_ italic_ and*** bold italic***aaaaaah';

const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"**bold** and also *italic* and ***bold italic***aaaaaah
"
Expand All @@ -25,7 +25,7 @@ describe('migrating emphasis', () => {
const md =
'*the recommended initial action is to**initiate a[reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback)**. *';

const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"*the recommended initial action is to**initiate a[reversal operation (rollback)](https://docs.jupico.com/reference/ccrollback)**.*
"
Expand Down
5 changes: 2 additions & 3 deletions __tests__/migration/html-comments.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('migrating html comments', () => {
it('migrates escaped html comments', () => {
Expand All @@ -21,8 +21,7 @@ describe('migrating html comments', () => {
\\-->
`;

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"{/*
Expand Down
5 changes: 2 additions & 3 deletions __tests__/migration/image.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('migrating images', () => {
it('compiles images', () => {
Expand All @@ -20,8 +20,7 @@ describe('migrating images', () => {
[/block]
`;

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"<Image align="center" className="border" border={true} src="https://fastly.picsum.photos/id/507/200/300.jpg?hmac=v0NKvUrOWTKZuZFmMlLN_7-RdRgeF-qFLeBGXpufxgg" />
"
Expand Down
8 changes: 3 additions & 5 deletions __tests__/migration/link-reference.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('mdx migration of link references', () => {
it('compiles link references correctly', () => {
const md = '[wat_wat]';

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"\\[wat\\_wat]
"
Expand All @@ -19,8 +18,7 @@ describe('mdx migration of link references', () => {
[wat_wat]: https://wat.com
`;

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"[wat\\_wat][wat_wat]
Expand Down
5 changes: 2 additions & 3 deletions __tests__/migration/magic-block.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('migrating magic blocks', () => {
it('compiles magic blocks without enough newlines', () => {
Expand Down Expand Up @@ -41,8 +41,7 @@ describe('migrating magic blocks', () => {
}
[/block]
`;
const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`

Check failure on line 45 in __tests__/migration/magic-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 16)

__tests__/migration/magic-block.test.ts > migrating magic blocks > compiles magic blocks without enough newlines

Error: Snapshot `migrating magic blocks > compiles magic blocks without enough newlines 1` mismatched - Expected + Received "## About cBEYONData - [ Overview of cBEYONData ](/docs/about-cbeyondata)&#x20; + [ Overview of cBEYONData ](/docs/about-cbeyondata) ## About CFO Control Control Tower - [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower)&#x20; + [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower) > ❗️ CONFIDENTIAL > - > *This documentation is confidential and proprietary information of cBEYONData LLC.*&#x20; + > *This documentation is confidential and proprietary information of cBEYONData LLC.* " ❯ __tests__/migration/magic-block.test.ts:45:17

Check failure on line 45 in __tests__/migration/magic-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 17)

__tests__/migration/magic-block.test.ts > migrating magic blocks > compiles magic blocks without enough newlines

Error: Snapshot `migrating magic blocks > compiles magic blocks without enough newlines 1` mismatched - Expected + Received "## About cBEYONData - [ Overview of cBEYONData ](/docs/about-cbeyondata)&#x20; + [ Overview of cBEYONData ](/docs/about-cbeyondata) ## About CFO Control Control Tower - [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower)&#x20; + [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower) > ❗️ CONFIDENTIAL > - > *This documentation is confidential and proprietary information of cBEYONData LLC.*&#x20; + > *This documentation is confidential and proprietary information of cBEYONData LLC.* " ❯ __tests__/migration/magic-block.test.ts:45:17

Check failure on line 45 in __tests__/migration/magic-block.test.ts

View workflow job for this annotation

GitHub Actions / Test (lts/-1, 18)

__tests__/migration/magic-block.test.ts > migrating magic blocks > compiles magic blocks without enough newlines

Error: Snapshot `migrating magic blocks > compiles magic blocks without enough newlines 1` mismatched - Expected + Received "## About cBEYONData - [ Overview of cBEYONData ](/docs/about-cbeyondata)&#x20; + [ Overview of cBEYONData ](/docs/about-cbeyondata) ## About CFO Control Control Tower - [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower)&#x20; + [Overview of CFO Control Tower](https://docs.cfocontroltower.com/docs/about-cfo-control-tower) > ❗️ CONFIDENTIAL > - > *This documentation is confidential and proprietary information of cBEYONData LLC.*&#x20; + > *This documentation is confidential and proprietary information of cBEYONData LLC.* " ❯ __tests__/migration/magic-block.test.ts:45:17
"## About cBEYONData
Expand Down
14 changes: 6 additions & 8 deletions __tests__/migration/tables.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as rmdx from '../../index';
import { migrate } from '../../index';

describe('mdx migration of tables', () => {
it('compiles tables with newlines and inline code', () => {
Expand All @@ -22,8 +22,7 @@ ${JSON.stringify(
[/block]
`;

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"<Table align={["left","left"]}>
<thead>
Expand Down Expand Up @@ -81,7 +80,7 @@ ${JSON.stringify(
)}
[/block]
`;
const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);

expect(mdx).toMatchInlineSnapshot(`
"<Table align={["left","left"]}>
Expand Down Expand Up @@ -150,7 +149,7 @@ ${JSON.stringify(
)}
[/block]
`;
const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);

expect(mdx).toMatchInlineSnapshot(`
"<Table align={["left","left"]}>
Expand Down Expand Up @@ -237,8 +236,7 @@ ${JSON.stringify(
[/block]
`;

const ast = rmdx.mdastV6(md);
const mdx = rmdx.mdx(ast);
const mdx = migrate(md);
expect(mdx).toMatchInlineSnapshot(`
"<Table align={["left","left"]}>
<thead>
Expand Down Expand Up @@ -299,7 +297,7 @@ ${JSON.stringify(
)}
[/block]
`;
const mdx = rmdx.mdx(rmdx.mdastV6(md));
const mdx = migrate(md);

expect(mdx).toMatchInlineSnapshot(`
"<Table>
Expand Down

0 comments on commit 3aae9ab

Please sign in to comment.