aboutsummaryrefslogtreecommitdiff
path: root/packages/create-astro/test/template.test.js
blob: 66c7f54468b5a4980cb82fe921e63dc37ad0cc04 (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
import { expect } from 'chai';

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

describe('template', () => {
	const fixture = setup();

	it('none', async () => {
		const context = { template: '', cwd: '', dryRun: true, prompt: () => ({ template: 'blog' }) };
		await template(context);

		expect(fixture.hasMessage('Skipping template copying')).to.be.true;
		expect(context.template).to.eq('blog');
	});

	it('minimal (--dry-run)', async () => {
		const context = { template: 'minimal', cwd: '', dryRun: true, prompt: () => {} };
		await template(context);
		expect(fixture.hasMessage('Using minimal as project template')).to.be.true;
	});

	it('basics (--dry-run)', async () => {
		const context = { template: 'basics', cwd: '', dryRun: true, prompt: () => {} };
		await template(context);

		expect(fixture.hasMessage('Using basics as project template')).to.be.true;
	});

	it('blog (--dry-run)', async () => {
		const context = { template: 'blog', cwd: '', dryRun: true, prompt: () => {} };
		await template(context);

		expect(fixture.hasMessage('Using blog as project template')).to.be.true;
	});
});