-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- [Fixed] Fix issue #6 (Build a correct component name from a file name)
- Loading branch information
Showing
5 changed files
with
63 additions
and
2 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
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
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
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
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,34 @@ | ||
const utils = require('../../../lib/utils'); | ||
const { expect } = require('chai'); | ||
|
||
describe('"utils.js" module', () => { | ||
describe('"buildCamelCase" method', () => { | ||
it('when input is already camel cased then should return same value', done => { | ||
const result = utils.buildCamelCase('CamelCasedTestMethodName12'); | ||
|
||
expect(result).be.equal('CamelCasedTestMethodName12'); | ||
done(); | ||
}); | ||
|
||
it('when spaces used in name then should remove them and make next char uppercased', done => { | ||
const result = utils.buildCamelCase('Spaces In the name'); | ||
|
||
expect(result).be.equal('SpacesInTheName'); | ||
done(); | ||
}); | ||
|
||
it('when first letter is lowercased then should be changed to upper case', done => { | ||
const result = utils.buildCamelCase('lowercasedFirstLetter'); | ||
|
||
expect(result).be.equal('LowercasedFirstLetter'); | ||
done(); | ||
}); | ||
|
||
it('when illegal chars in name then should remove then and make next char uppercased', done => { | ||
const result = utils.buildCamelCase('Illegal-chars-In-the-name'); | ||
|
||
expect(result).to.be.equal('IllegalCharsInTheName'); | ||
done(); | ||
}); | ||
}); | ||
}); |