summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/project-name.test.js
diff options
context:
space:
mode:
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');
+ });
});