Skip to content

Commit 54e37d2

Browse files
author
Philipp Alferov
committed
Fix test case not identifying mutation of provided array
1 parent 2f80a91 commit 54e37d2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/test.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ var toTree = require('../index.js');
66
var initial = [
77
{
88
id: 1,
9-
parent_id: null
9+
parent_id: null,
10+
children: [{ id: 5 }]
1011
},
1112
{
1213
id: 2,
@@ -25,13 +26,17 @@ var initial = [
2526
var current;
2627

2728
describe('array-to-tree', function() {
28-
describe('with valid arguments', function() {
29+
describe('with default arguments', function() {
2930
beforeEach(function() {
3031
current = toTree(initial);
3132
});
3233

33-
it('should not modify passed object', function() {
34-
expect(initial).to.be.deep.equal(initial);
34+
it('should not modify given array', function() {
35+
expect(initial[0]).to.be.deep.equal({
36+
id: 1,
37+
parent_id: null,
38+
children: [{ id: 5 }]
39+
});
3540
});
3641

3742
it('should return an array', function() {
@@ -96,7 +101,7 @@ describe('array-to-tree', function() {
96101
});
97102
});
98103

99-
describe('with different options', function() {
104+
describe('with custom arguments', function() {
100105
it('should work with custom parents links', function() {
101106
expect(
102107
toTree(

0 commit comments

Comments
 (0)