-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
69 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect } from "chai"; | ||
|
||
import Fakerator from "lib/fakerator"; | ||
|
||
describe("Fakerator utils", () => { | ||
|
||
let fakerator; | ||
|
||
beforeEach( () => { | ||
fakerator = new Fakerator(); | ||
fakerator.seed(4278); | ||
}); | ||
|
||
it("check slugify function", () => { | ||
expect(fakerator.slugify(" This is a * very_complex-text!with Extra character(s). ")) | ||
.to.be.equal("This-is-a--very_complex-textwith---Extra-characters."); | ||
}); | ||
|
||
it("check replaceSymbols function", () => { | ||
expect(fakerator.replaceSymbols("ABC-###-XYZ")) | ||
.to.be.equal("ABC-445-XYZ"); | ||
|
||
expect(fakerator.replaceSymbols("???-###-???")) | ||
.to.be.equal("arp-306-gxi"); | ||
|
||
}); | ||
|
||
it("check shuffle function", () => { | ||
let arr = [1,2,3,4,5,6,7,8,9]; | ||
|
||
expect(fakerator.shuffle()) | ||
.to.be.undefined; | ||
|
||
expect(fakerator.shuffle(arr)) | ||
.to.be.deep.equal([ 6, 8, 3, 1, 2, 7, 4, 5, 9 ]); | ||
|
||
}); | ||
}) |
Empty file.
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,28 @@ | ||
import { expect } from "chai"; | ||
|
||
import Fakerator from "lib/fakerator"; | ||
|
||
describe("Fakerator.times", () => { | ||
|
||
let fakerator; | ||
|
||
beforeEach( () => { | ||
fakerator = new Fakerator(); | ||
fakerator.seed(4278); | ||
}); | ||
|
||
it("check times function with names", () => { | ||
let res = fakerator.times(fakerator.names.name, 3); | ||
expect(res).to.be.an("Array"); | ||
expect(res).to.be.length(3); | ||
expect(res).to.be.deep.equal([ "Ross Hansen", "Thomas Pfeffer", "Alexis Hauck I" ]); | ||
}); | ||
|
||
it("check times function with random.number", () => { | ||
let res = fakerator.times(fakerator.random.number, 10, 50, 1); | ||
expect(res).to.be.an("Array"); | ||
expect(res).to.be.length(10); | ||
expect(res).to.be.deep.equal( [25, 24, 29, 17, 2, 33, 1, 35, 31, 13] ); | ||
}); | ||
|
||
}) |