Skip to content

Commit

Permalink
Begin spiking out import separation repro
Browse files Browse the repository at this point in the history
  • Loading branch information
johno committed Feb 28, 2019
1 parent b57fd68 commit d6a6bc0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/remark-mdx/test/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,10 @@ Object {
"type": "root",
}
`;
exports[`removes newlines between imports and exports 1`] = `
"import Foo1 from \\"./foo\\"
import Foo2 from \\"./foo\\"
import Foo3 from \\"./foo\\"
"
`;
21 changes: 21 additions & 0 deletions packages/remark-mdx/test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const unified = require('unified')
const remarkParse = require('remark-parse')
const remarkStringify = require('remark-stringify')

const remarkMdx = require('..')
const mdxAstToMdxHast = require('../../mdx/mdx-ast-to-mdx-hast')
const mdxHastToJsx = require('../../mdx/mdx-hast-to-jsx')
Expand Down Expand Up @@ -41,6 +43,16 @@ const parse = mdx => {
return result
}

const stringify = mdx => {
const result = unified()
.use(remarkParse)
.use(remarkStringify)
.use(remarkMdx)
.processSync(mdx)

return result.contents
}

it('correctly transpiles', () => {
const result = transpile(FIXTURE)

Expand All @@ -52,3 +64,12 @@ it('maintains the proper positional info', () => {

expect(result).toMatchSnapshot()
})

it('removes newlines between imports and exports', () => {
const fixture =
'import Foo1 from "./foo"\nimport Foo2 from "./foo"\nimport Foo3 from "./foo"'

const result = stringify(fixture)

expect(result).toMatchSnapshot()
})

0 comments on commit d6a6bc0

Please sign in to comment.