diff options
author | 2025-06-05 14:25:23 +0000 | |
---|---|---|
committer | 2025-06-05 14:25:23 +0000 | |
commit | e586d7d704d475afe3373a1de6ae20d504f79d6d (patch) | |
tree | 7e3fa24807cebd48a86bd40f866d792181191ee9 /packages/create-astro/test/template.test.js | |
download | astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.gz astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.zst astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.zip |
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'packages/create-astro/test/template.test.js')
-rw-r--r-- | packages/create-astro/test/template.test.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/create-astro/test/template.test.js b/packages/create-astro/test/template.test.js new file mode 100644 index 000000000..821ac9c2e --- /dev/null +++ b/packages/create-astro/test/template.test.js @@ -0,0 +1,39 @@ +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')); + }); +}); |