Skip to content

Commit 3e144cf

Browse files
committed
Added array to the mock data in test to validate that arrays now concat correctly.
1 parent 1c2276b commit 3e144cf

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

test/nestedObjectAssign.spec.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,70 @@
11
import { expect } from 'chai';
22
import nestedObjectAssign from '../index.js';
33

4-
var mockData = {
4+
const mockData = {
55
default: {
66
heading: 'title',
77
body: {
88
paragraph: 'p',
99
heading: 'h1'
10-
}
10+
},
11+
products: [
12+
{
13+
paragraph: 'p',
14+
heading: 'h1'
15+
}
16+
]
1117
},
1218
first: {
1319
body: {
1420
span: 'span',
1521
header: 'header'
16-
}
22+
},
23+
products: [
24+
{
25+
span: 'span',
26+
header: 'header'
27+
}
28+
]
1729
},
1830
second: {
1931
body: {
2032
heading2: 'h2'
21-
}
33+
},
34+
products: [
35+
{
36+
heading2: 'h2'
37+
}
38+
]
2239
}
23-
2440
};
2541

26-
var expectedData = {
42+
const expectedData = {
2743
heading: 'title',
2844
body: {
2945
paragraph: 'p',
3046
heading: 'h1',
3147
span: 'span',
3248
header: 'header',
3349
heading2: 'h2'
34-
}
50+
},
51+
products: [
52+
{
53+
paragraph: 'p',
54+
heading: 'h1'
55+
},
56+
{
57+
span: 'span',
58+
header: 'header'
59+
},
60+
{
61+
heading2: 'h2'
62+
}
63+
]
3564
};
3665

3766
describe('Given an instance of nestedObjectAssign', function() {
38-
describe('when i merge the mockData', function() {
67+
describe('when I merge the mockData', function() {
3968
it('it should be equal to expectedData', () => {
4069
expect(JSON.stringify(nestedObjectAssign({}, mockData.default, mockData.first, mockData.second))).to.be.equal(JSON.stringify(expectedData));
4170
});

0 commit comments

Comments
 (0)