forked from facebook/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix template name handling (facebook#9412)
- Loading branch information
Showing
5 changed files
with
280 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"env": { | ||
"jest": true | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
packages/create-react-app/__tests__/getTemplateInstallPackage.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const { getTemplateInstallPackage } = require('../createReactApp'); | ||
|
||
describe('getTemplateInstallPackage', () => { | ||
it('no options gives cra-template', async () => { | ||
await expect(getTemplateInstallPackage()).resolves.toBe('cra-template'); | ||
}); | ||
|
||
it('cra-template gives cra-template', async () => { | ||
await expect(getTemplateInstallPackage('cra-template')).resolves.toBe( | ||
'cra-template' | ||
); | ||
}); | ||
|
||
it('cra-template-typescript gives cra-template-typescript', async () => { | ||
await expect(getTemplateInstallPackage('cra-template-typescript')).resolves.toBe( | ||
'cra-template-typescript' | ||
); | ||
}); | ||
|
||
it('typescript gives cra-template-typescript', async () => { | ||
await expect(getTemplateInstallPackage('typescript')).resolves.toBe( | ||
'cra-template-typescript' | ||
); | ||
}); | ||
|
||
it('typescript@next gives cra-template-typescript@next', async () => { | ||
await expect(getTemplateInstallPackage('cra-template-typescript@next')).resolves.toBe( | ||
'cra-template-typescript@next' | ||
); | ||
}); | ||
|
||
it('cra-template@next gives cra-template@next', async () => { | ||
await expect(getTemplateInstallPackage('cra-template@next')).resolves.toBe( | ||
'cra-template@next' | ||
); | ||
}); | ||
|
||
it('cra-template-typescript@next gives cra-template-typescript@next', async () => { | ||
await expect(getTemplateInstallPackage('cra-template-typescript@next')).resolves.toBe( | ||
'cra-template-typescript@next' | ||
); | ||
}); | ||
|
||
it('@iansu gives @iansu/cra-template', async () => { | ||
await expect(getTemplateInstallPackage('@iansu')).resolves.toBe( | ||
'@iansu/cra-template' | ||
); | ||
}); | ||
|
||
it('@iansu/cra-template gives @iansu/cra-template', async () => { | ||
await expect( | ||
getTemplateInstallPackage('@iansu/cra-template') | ||
).resolves.toBe('@iansu/cra-template'); | ||
}); | ||
|
||
it('@iansu/cra-template@next gives @iansu/cra-template@next', async () => { | ||
await expect( | ||
getTemplateInstallPackage('@iansu/cra-template@next') | ||
).resolves.toBe('@iansu/cra-template@next'); | ||
}); | ||
|
||
it('@iansu/cra-template-typescript@next gives @iansu/cra-template-typescript@next', async () => { | ||
await expect(getTemplateInstallPackage('@iansu/cra-template-typescript@next')).resolves.toBe( | ||
'@iansu/cra-template-typescript@next' | ||
); | ||
}); | ||
|
||
it('http://example.com/cra-template.tar.gz gives http://example.com/cra-template.tar.gz', async () => { | ||
await expect( | ||
getTemplateInstallPackage('http://example.com/cra-template.tar.gz') | ||
).resolves.toBe('http://example.com/cra-template.tar.gz'); | ||
}); | ||
}); |
Oops, something went wrong.