0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/markdown/remark/test/plugins.test.js
Ben Holmes 52209ca2ad
[Content collections] Remove experimental flag (#5825)
* refactor: remove experimental.cc from core

* chore: remove experimental flag from tests

* fix: mock contentDir in remark tests

* fix: check vfile.path in rel-image-error plugin

* fix: move .astro/ excludes to all test/fixtures

* fix: include test/**/fixtures in ignore

* chore: changeset
2023-01-11 12:51:31 -05:00

28 lines
774 B
JavaScript

import { renderMarkdown } from '../dist/index.js';
import { mockRenderMarkdownParams } from './test-utils.js';
import chai from 'chai';
import { fileURLToPath } from 'node:url';
describe('plugins', () => {
// https://github.com/withastro/astro/issues/3264
it('should be able to get file path when passing fileURL', async () => {
let context;
await renderMarkdown(`test`, {
...mockRenderMarkdownParams,
fileURL: new URL('virtual.md', import.meta.url),
remarkPlugins: [
function () {
const transformer = (tree, file) => {
context = file;
};
return transformer;
},
],
});
chai.expect(typeof context).to.equal('object');
chai.expect(context.path).to.equal(fileURLToPath(new URL('virtual.md', import.meta.url)));
});
});