aboutsummaryrefslogtreecommitdiff
path: root/packages/create-astro/test/project-name.test.js
diff options
context:
space:
mode:
authorGravatar aswind7 <qfei.shao@gmail.com> 2023-09-06 21:22:18 +0800
committerGravatar GitHub <noreply@github.com> 2023-09-06 09:22:18 -0400
commitb81ff8fcefe6c30312d7b2050a63b1520d79b25f (patch)
tree81506feb8d6a26a6baaf07a89fa788f0095b1bc8 /packages/create-astro/test/project-name.test.js
parent2272f8d3c4f4c5c836a5ef356c8bfd29bb801382 (diff)
downloadastro-b81ff8fcefe6c30312d7b2050a63b1520d79b25f.tar.gz
astro-b81ff8fcefe6c30312d7b2050a63b1520d79b25f.tar.zst
astro-b81ff8fcefe6c30312d7b2050a63b1520d79b25f.zip
trim project name of the user input (#8427)
* fix: remove duplicate import * project name should be trimed * update changeset
Diffstat (limited to 'packages/create-astro/test/project-name.test.js')
-rw-r--r--packages/create-astro/test/project-name.test.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/create-astro/test/project-name.test.js b/packages/create-astro/test/project-name.test.js
index f297da076..a78207369 100644
--- a/packages/create-astro/test/project-name.test.js
+++ b/packages/create-astro/test/project-name.test.js
@@ -62,6 +62,15 @@ describe('project name', () => {
expect(context.projectName).to.eq('foobar');
});
+
+ it('blank space', async () => {
+ const context = { projectName: '', cwd: '', prompt: () => ({ name: 'foobar ' }) };
+ await projectName(context);
+
+ expect(context.cwd).to.eq('foobar');
+ expect(context.projectName).to.eq('foobar');
+ });
+
it('normalize', async () => {
const context = { projectName: '', cwd: '', prompt: () => ({ name: 'Invalid Name' }) };
await projectName(context);