summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/verify.test.js
blob: ecfaba7279a5c17daa053f22a426989fbf09a7a3 (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
34
35
36
37
38
39
40
41
import { expect } from 'chai';

import { verify } from '../dist/index.js';
import { setup } from './utils.js';

describe('verify', () => {
	const fixture = setup();
	const exit = (code) => {
		throw code;
	};

	it('basics', async () => {
		const context = { template: 'basics', exit };
		await verify(context);
		expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages');
	});

	it('missing', async () => {
		const context = { template: 'missing', exit };
		let err = null;
		try {
			await verify(context);
		} catch (e) {
			err = e;
		}
		expect(err).to.eq(1);
		expect(fixture.hasMessage('Template missing does not exist!'));
	});

	it('starlight', async () => {
		const context = { template: 'starlight', exit };
		await verify(context);
		expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages');
	});

	it('starlight/tailwind', async () => {
		const context = { template: 'starlight/tailwind', exit };
		await verify(context);
		expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages');
	});
});