diff options
author | 2023-09-06 21:22:18 +0800 | |
---|---|---|
committer | 2023-09-06 09:22:18 -0400 | |
commit | b81ff8fcefe6c30312d7b2050a63b1520d79b25f (patch) | |
tree | 81506feb8d6a26a6baaf07a89fa788f0095b1bc8 /packages/create-astro/test/project-name.test.js | |
parent | 2272f8d3c4f4c5c836a5ef356c8bfd29bb801382 (diff) | |
download | astro-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.js | 9 |
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); |