summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/verify.test.js
blob: ff335014517c802c80fb7befce374f665dc7880f (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 assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { verify } from '../dist/index.js';
import { setup } from './utils.js';

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

	it('basics', async () => {
		const context = { template: 'basics', exit };
		await verify(context);
		assert.equal(fixture.messages().length, 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;
		}
		assert.equal(err, 1);
		assert.ok(!fixture.hasMessage('Template missing does not exist!'));
	});

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

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