astro/packages/astro/test/markdown.test.js
2021-11-09 10:06:25 -07:00

34 lines
963 B
JavaScript

import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/markdown/',
buildOptions: {
sitemap: false,
},
renderers: ['@astrojs/renderer-preact'],
});
await fixture.build();
});
describe('Markdown tests', () => {
it('Can load a simple markdown page with Astro', async () => {
const html = await fixture.readFile('/post/index.html');
const $ = cheerio.load(html);
expect($('p').first().text()).to.equal('Hello world!');
expect($('#first').text()).to.equal('Some content');
expect($('#interesting-topic').text()).to.equal('Interesting Topic');
});
it('Can load a realworld markdown page with Astro', async () => {
const html = await fixture.readFile('/realworld/index.html');
const $ = cheerio.load(html);
expect($('pre')).to.have.lengthOf(7);
});
});