summaryrefslogtreecommitdiff
path: root/packages/integrations/image/test/assets-prefix.test.js
blob: 099acfeb36a6de049dd2276342dd6991937640cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { expect } from 'chai';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';

const assetsPrefixRegex = /^http:\/\/localhost:4321\/_astro\/.*/;

describe('Assets Prefix', function () {
	/** @type {import('../../../astro/test/test-utils').Fixture} */
	let fixture;

	before(async () => {
		fixture = await loadFixture({ root: './fixtures/assets-prefix/' });
		await fixture.build();
	});

	it('images src has assets prefix', async () => {
		const html = await fixture.readFile('/index.html');
		const $ = cheerio.load(html);
		const img = $('#social-jpg');
		expect(img.attr('src')).to.match(assetsPrefixRegex);
	});
});