astro/packages/astro/test/lazy-layout.test.js
Matthew Phillips ff7ba0ee0f
Ensure head content rendered once with lazy layouts (#4892)
* Ensure head content rendered once with lazy layouts

* Add changeset
2022-09-28 10:55:06 -04:00

19 lines
526 B
JavaScript

import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
describe('Lazily imported layouts', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
before(async () => {
fixture = await loadFixture({ root: './fixtures/lazy-layout/' });
await fixture.build();
});
it('Renders styles only once', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);
expect($('link')).to.have.a.lengthOf(1);
});
});