mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
3007d24c98
* chore: Migrate All packages/create-astro/test to node:test * Some minor fix * Requested Changes done * Reopen * Apply suggestions from code review * let's test with concurrency * chore: fix possible false positive tests * todo test * skip tests * Apply suggestions from code review --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
import { template } from '../dist/index.js';
|
|
import { setup } from './utils.js';
|
|
|
|
describe('template', async () => {
|
|
const fixture = setup();
|
|
|
|
it('none', async () => {
|
|
const context = { template: '', cwd: '', dryRun: true, prompt: () => ({ template: 'blog' }) };
|
|
await template(context);
|
|
assert.ok(fixture.hasMessage('Skipping template copying'));
|
|
assert.equal(context.template, 'blog');
|
|
});
|
|
|
|
it('minimal (--dry-run)', async () => {
|
|
const context = { template: 'minimal', cwd: '', dryRun: true, prompt: () => {} };
|
|
await template(context);
|
|
assert.ok(fixture.hasMessage('Using minimal as project template'));
|
|
});
|
|
|
|
it('basics (--dry-run)', async () => {
|
|
const context = { template: 'basics', cwd: '', dryRun: true, prompt: () => {} };
|
|
await template(context);
|
|
assert.ok(fixture.hasMessage('Using basics as project template'));
|
|
});
|
|
|
|
it('blog (--dry-run)', async () => {
|
|
const context = { template: 'blog', cwd: '', dryRun: true, prompt: () => {} };
|
|
await template(context);
|
|
assert.ok(fixture.hasMessage('Using blog as project template'));
|
|
});
|
|
|
|
it('minimal (--yes)', async () => {
|
|
const context = { template: 'minimal', cwd: '', dryRun: true, yes: true, prompt: () => {} };
|
|
await template(context);
|
|
assert.ok(fixture.hasMessage('Using minimal as project template'));
|
|
});
|
|
});
|