summaryrefslogtreecommitdiff
path: root/packages/create-astro/test
diff options
context:
space:
mode:
authorGravatar Jacob Lamb <jacobtlamb@hey.com> 2023-09-19 02:09:27 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-19 17:09:27 +0800
commit1d5b3f079d0b4aa5a5c46f97b8b724ab88497fbe (patch)
tree88447f1b3f7a9bf40d620101c831919c6242e112 /packages/create-astro/test
parentd0e513f214fe3cb30bab6d98936cda796477f2f8 (diff)
downloadastro-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.js44
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');
+ });
});