0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/create-astro/test/template.test.js
2023-09-22 13:20:50 +00:00

43 lines
1.4 KiB
JavaScript

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;
});
it('minimal (--yes)', async () => {
const context = { template: 'minimal', cwd: '', dryRun: true, yes: true, prompt: () => {} };
await template(context);
expect(fixture.hasMessage('Using minimal as project template')).to.be.true;
});
});