aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/helpers.unit.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/helpers.unit.js b/test/helpers.unit.js
index 5c8b31d5..f08be413 100644
--- a/test/helpers.unit.js
+++ b/test/helpers.unit.js
@@ -43,6 +43,19 @@ describe("helpers.js", function () {
var shuffled = faker.helpers.shuffle([]);
assert.ok(shuffled.length === 0);
});
+
+ it("mutates the input array in place", function () {
+ var input = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"];
+ var shuffled = faker.helpers.shuffle(input);
+ assert.deepEqual(shuffled, input);
+ });
+
+ it("all items shuffled as expected when seeded", function () {
+ var input = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"];
+ faker.seed(100);
+ var shuffled = faker.helpers.shuffle(input);
+ assert.deepEqual(shuffled, ["b", "e", "a", "d", "j", "i", "h", "c", "g", "f"]);
+ });
});
describe("slugify()", function () {