diff options
author | 2023-09-19 02:09:27 -0700 | |
---|---|---|
committer | 2023-09-19 17:09:27 +0800 | |
commit | 1d5b3f079d0b4aa5a5c46f97b8b724ab88497fbe (patch) | |
tree | 88447f1b3f7a9bf40d620101c831919c6242e112 /packages/create-astro/test | |
parent | d0e513f214fe3cb30bab6d98936cda796477f2f8 (diff) | |
download | astro-1d5b3f079d0b4aa5a5c46f97b8b724ab88497fbe.tar.gz astro-1d5b3f079d0b4aa5a5c46f97b8b724ab88497fbe.tar.zst astro-1d5b3f079d0b4aa5a5c46f97b8b724ab88497fbe.zip |
feat(create-astro): Update flag behavior for template and project-name (#8551)
Diffstat (limited to '')
-rw-r--r-- | packages/create-astro/test/project-name.test.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/create-astro/test/project-name.test.js b/packages/create-astro/test/project-name.test.js index 4b8cdce7f..1672fce66 100644 --- a/packages/create-astro/test/project-name.test.js +++ b/packages/create-astro/test/project-name.test.js @@ -92,4 +92,48 @@ describe('project name', () => { expect(context.cwd).to.eq('@astro/site'); expect(context.projectName).to.eq('@astro/site'); }); + + it('--yes', async () => { + const context = { + projectName: '', + cwd: './foo/bar/baz', + yes: true, + prompt: () => {}, + }; + await projectName(context); + expect(context.projectName).to.eq('baz'); + }); + + it('dry run with name', async () => { + const context = { + projectName: '', + cwd: './foo/bar/baz', + dryRun: true, + prompt: () => {}, + }; + await projectName(context); + expect(context.projectName).to.eq('baz'); + }); + + it('dry run with dot', async () => { + const context = { + projectName: '', + cwd: '.', + dryRun: true, + prompt: () => ({ name: 'foobar' }), + }; + await projectName(context); + expect(context.projectName).to.eq('foobar'); + }); + + it('dry run with empty', async () => { + const context = { + projectName: '', + cwd: './test/fixtures/empty', + dryRun: true, + prompt: () => ({ name: 'foobar' }), + }; + await projectName(context); + expect(context.projectName).to.eq('empty'); + }); }); |