-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed function name to be more descriptive
- Loading branch information
1 parent
6b63f41
commit 0d36df4
Showing
3 changed files
with
8 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
const { assert } = require('chai'); | ||
const { WORD } = require('../modules/string'); | ||
const { GIBBERISH } = require('../modules/string'); | ||
|
||
describe('STRING()', function () { | ||
it('Should throw TypeError if less than 1 parameter is sent', function () { | ||
assert.throw(() => { WORD() }, TypeError, 'One parameter required'); | ||
assert.throw(() => { GIBBERISH() }, TypeError, 'One parameter required'); | ||
}); | ||
|
||
it('Should throw TypeError if more than 2 parameter are sent', function () { | ||
assert.throw(() => { WORD(1, 2) }, TypeError, 'One parameter required'); | ||
assert.throw(() => { GIBBERISH(1, 2) }, TypeError, 'One parameter required'); | ||
}); | ||
|
||
it('Should throw TypeError if parameter is not Number', function () { | ||
assert.throw(() => { WORD(true) }, TypeError, 'Length parameter must be Number'); | ||
assert.throw(() => { GIBBERISH(true) }, TypeError, 'Length parameter must be Number'); | ||
}); | ||
|
||
it('Should return random string consisting of 30 character', function () { | ||
const result = WORD(30); | ||
const result = GIBBERISH(30); | ||
assert.lengthOf(result, 30); | ||
}); | ||
|
||
it('Should test if returned value is Number', function () { | ||
const result = WORD(30); | ||
const result = GIBBERISH(30); | ||
assert.isString(result); | ||
}); | ||
}); |