2023-02-06 16:19:37 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
|
|
import { template } from '../dist/index.js';
|
|
|
|
import { setup } from './utils.js';
|
|
|
|
|
|
|
|
describe('template', () => {
|
|
|
|
const fixture = setup();
|
|
|
|
|
|
|
|
it('none', async () => {
|
2023-02-06 16:21:48 +00:00
|
|
|
const context = { template: '', cwd: '', dryRun: true, prompt: () => ({ template: 'blog' }) };
|
2023-02-06 16:19:37 +00:00
|
|
|
await template(context);
|
|
|
|
|
|
|
|
expect(fixture.hasMessage('Skipping template copying')).to.be.true;
|
|
|
|
expect(context.template).to.eq('blog');
|
2023-02-06 16:21:48 +00:00
|
|
|
});
|
2023-02-06 16:19:37 +00:00
|
|
|
|
|
|
|
it('minimal (--dry-run)', async () => {
|
2023-02-06 16:21:48 +00:00
|
|
|
const context = { template: 'minimal', cwd: '', dryRun: true, prompt: () => {} };
|
2023-02-06 16:19:37 +00:00
|
|
|
await template(context);
|
|
|
|
expect(fixture.hasMessage('Using minimal as project template')).to.be.true;
|
2023-02-06 16:21:48 +00:00
|
|
|
});
|
2023-02-06 16:19:37 +00:00
|
|
|
|
|
|
|
it('basics (--dry-run)', async () => {
|
2023-02-06 16:21:48 +00:00
|
|
|
const context = { template: 'basics', cwd: '', dryRun: true, prompt: () => {} };
|
2023-02-06 16:19:37 +00:00
|
|
|
await template(context);
|
|
|
|
|
|
|
|
expect(fixture.hasMessage('Using basics as project template')).to.be.true;
|
2023-02-06 16:21:48 +00:00
|
|
|
});
|
2023-02-06 16:19:37 +00:00
|
|
|
|
|
|
|
it('blog (--dry-run)', async () => {
|
2023-02-06 16:21:48 +00:00
|
|
|
const context = { template: 'blog', cwd: '', dryRun: true, prompt: () => {} };
|
2023-02-06 16:19:37 +00:00
|
|
|
await template(context);
|
|
|
|
|
|
|
|
expect(fixture.hasMessage('Using blog as project template')).to.be.true;
|
2023-02-06 16:21:48 +00:00
|
|
|
});
|
|
|
|
});
|