summaryrefslogtreecommitdiff
path: root/packages/astro/test/head-injection-md.test.js
blob: 1acd5e83bd7735e72e02b24060e910ae8ecc725d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';

describe('Head injection with markdown', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/head-injection-md/',
		});
	});

	describe('build', () => {
		before(async () => {
			await fixture.build();
		});

		it('only injects head content once', async () => {
			const html = await fixture.readFile(`/index.html`);
			const $ = cheerio.load(html);

			expect($('link[rel=stylesheet]')).to.have.a.lengthOf(1);
		});
	});
});