Skip to content

Commit efb0bad

Browse files
committed
Add test for new objects in props patches
1 parent d5ee016 commit efb0bad

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test('unist-diff', function (t) {
5454
});
5555

5656
t.test('`props`', function (st) {
57-
st.plan(10);
57+
st.plan(11);
5858

5959
(function () {
6060
var alpha = {type: 'alpha'};
@@ -206,6 +206,25 @@ test('unist-diff', function (t) {
206206
);
207207
})();
208208

209+
(function () {
210+
var alpha = {type: 'alpha'};
211+
var left = {type: 'bravo', charlie: [1, 2], children: [alpha]};
212+
var right = {type: 'bravo', charlie: {delta: true}, children: [alpha]};
213+
214+
st.deepEqual(
215+
diff(left, right),
216+
{
217+
0: {
218+
type: 'props',
219+
left: left,
220+
right: {charlie: {delta: true}}
221+
},
222+
left: left
223+
},
224+
'should return a `props` patch for an array changed to an object'
225+
);
226+
})();
227+
209228
(function () {
210229
var alpha = {type: 'alpha'};
211230
var left = {type: 'bravo', charlie: {delta: true}, children: [alpha]};

0 commit comments

Comments
 (0)