0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/mdx/test/mdx-get-static-paths.test.js
Emanuele Stoppa 062623438b
chore: use biome to sort imports - only test files (#10180)
* chore: use biome to sort imports

* do the sorting

* Update package.json

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2024-02-21 14:08:19 +00:00

34 lines
1 KiB
JavaScript

import mdx from '@astrojs/mdx';
import * as assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from '../../../astro/test/test-utils.js';
const FIXTURE_ROOT = new URL('./fixtures/mdx-get-static-paths', import.meta.url);
describe('getStaticPaths', () => {
/** @type {import('astro/test/test-utils').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({
root: FIXTURE_ROOT,
integrations: [mdx()],
});
await fixture.build();
});
it('Provides file and url', async () => {
const html = await fixture.readFile('/one/index.html');
const $ = cheerio.load(html);
assert.equal($('p').text(), 'First mdx file');
assert.equal($('#one').text(), 'hello', 'Frontmatter included');
assert.equal($('#url').text(), 'src/content/1.mdx', 'url is included');
assert.equal(
$('#file').text().includes('fixtures/mdx-get-static-paths/src/content/1.mdx'),
true,
'file is included'
);
});
});