f42f47dc6a
* wip: dream api
* deps: rollup types
* feat: get entry data in there
* fix: properly show mdoc errors in overlay
* feat: implement with cache
* fix: wait for in-flight entry resolution
* test: entry properties can be rendered
* chore: changeset
* fix: remove rollup type import
* Revert "deps: rollup types"
This reverts commit 484ccb1c81
.
* docs: add README reference
* docs nit: missing space
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
* refactor: split config config loading to separate helper
* refactor: choose more readable variable names
* refactor: store awaiting queue in existing cache
* docs: add clear code comments
* nit: add skip module code comment
* refactor: add `idHandledByContentRenderPlugin`
* nit: store chokidar modified events in const
* fix: remove loop from content renderer
* nit: else if -> if
---------
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
import { parseHTML } from 'linkedom';
|
|
import { expect } from 'chai';
|
|
import { loadFixture } from '../../../astro/test/test-utils.js';
|
|
import markdoc from '../dist/index.js';
|
|
|
|
const root = new URL('./fixtures/entry-prop/', import.meta.url);
|
|
|
|
describe('Markdoc - Entry prop', () => {
|
|
let baseFixture;
|
|
|
|
before(async () => {
|
|
baseFixture = await loadFixture({
|
|
root,
|
|
integrations: [markdoc()],
|
|
});
|
|
});
|
|
|
|
describe('dev', () => {
|
|
let devServer;
|
|
|
|
before(async () => {
|
|
devServer = await baseFixture.startDevServer();
|
|
});
|
|
|
|
after(async () => {
|
|
await devServer.stop();
|
|
});
|
|
|
|
it('has expected entry properties', async () => {
|
|
const res = await baseFixture.fetch('/');
|
|
const html = await res.text();
|
|
const { document } = parseHTML(html);
|
|
expect(document.querySelector('h1')?.textContent).to.equal('Processed by schema: Test entry');
|
|
expect(document.getElementById('id')?.textContent?.trim()).to.equal('id: entry.mdoc');
|
|
expect(document.getElementById('slug')?.textContent?.trim()).to.equal('slug: entry');
|
|
expect(document.getElementById('collection')?.textContent?.trim()).to.equal(
|
|
'collection: blog'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('build', () => {
|
|
before(async () => {
|
|
await baseFixture.build();
|
|
});
|
|
|
|
it('has expected entry properties', async () => {
|
|
const html = await baseFixture.readFile('/index.html');
|
|
const { document } = parseHTML(html);
|
|
expect(document.querySelector('h1')?.textContent).to.equal('Processed by schema: Test entry');
|
|
expect(document.getElementById('id')?.textContent?.trim()).to.equal('id: entry.mdoc');
|
|
expect(document.getElementById('slug')?.textContent?.trim()).to.equal('slug: entry');
|
|
expect(document.getElementById('collection')?.textContent?.trim()).to.equal(
|
|
'collection: blog'
|
|
);
|
|
});
|
|
});
|
|
});
|