summaryrefslogtreecommitdiff
path: root/packages/integrations/image/test/no-alt-text-image-ssr.test.js
blob: 95d6572bca00ad4b4fb1ef8c31ffdb5d12c48bd6 (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
28
29
30
31
32
33
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
import testAdapter from '../../../astro/test/test-adapter.js';

let fixture;

const errorMessage =
	'The <Image> component requires you provide alt text. If this image does not require an accessible label, set alt="".';

/** TODO: enable the test once missing alt text throws an error instead of a console warning */
describe.skip('SSR image without alt text', function () {
	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/no-alt-text-image/',
			adapter: testAdapter({ streaming: false }),
			output: 'server',
		});
		await fixture.build();
	});

	it('throws during build', async () => {
		try {
			const app = await fixture.loadTestAdapterApp();
			const request = new Request('http://example.com/');
			const response = await app.render(request);
			await response.text();
		} catch (err) {
			expect(err.message).to.equal(errorMessage);
			return;
		}
		expect.fail(0, 1, 'Exception not thrown');
	});
});