lion
lion copied to clipboard
[remark-extend] failing tests for advanced js
Test cases that illustrate the issue addressed here: https://github.com/ing-bank/lion/issues/1578
it('supports js content', async () => {
const result = await executeMd(
[
//
"```js ::importBlockContent('./fixtures/js-simple.md', '## Simple')",
'```',
].join('\n'),
);
expect(result).to.equal(
[
//
'```js',
"const x = 'My Example';",
'```',
'',
].join('\n'),
);
});
it('considers variables outside imported block', async () => {
const result = await executeMd(
[
//
"```js ::importBlockContent('./fixtures/js-advanced-1.md', '## Consuming shared var')",
'```',
].join('\n'),
);
expect(result).to.equal(
[
//
'```js',
"import { sharedVar } from 'some-global-lib';",
// This file is needed for its side effect
// Note its location changed from '../some-local-file.js' to './some-local-file.js'
"import './some-local-file.js';",
'```',
'',
'```js',
'export const x = sharedVar`My Example`;',
'```',
'',
].join('\n'),
);
});
// N.B. if the goal of remark-extend is only to extend lion docs, we can limit the
// functionality to 1:1 mappings of page names and leave this a nice to have
it.skip('considers name clashes in variables outside imported blocks of multiple files', async () => {
const result = await executeMd(
[
//
"```js ::importBlockContent('./fixtures/js-advanced-1.md', '## Consuming shared var')",
'```',
'',
"```js ::importBlockContent('./fixtures/js-advanced-2.md', '## Consuming conflicting shared var')",
'```',
].join('\n'),
);
expect(result).to.equal(
[
//
'```js',
"import { sharedVar } from 'some-global-lib';",
"import { sharedVar_2 } from 'some-other-global-lib';",
"import '../some-local-file.js';",
'```',
'',
'```js',
'export const x = sharedVar`My Example`;',
'```',
'',
'```js',
'export const y = sharedVar_2`My Example`;',
'```',
'',
].join('\n'),
);
});
⚠️ No Changeset found
Latest commit: dc7355bbea609a207a496d2b44a7f7ef62688668
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This PR is abandoned, please reopen and update it if you still want this fix applied in our codebase.