mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Fixed bug in function, add more tests
This commit is contained in:
parent
9771b21093
commit
802e8f8e32
@ -18,6 +18,8 @@ exports[`reducers utils observeChanges shoud be the same - returns false 8`] = `
|
||||
|
||||
exports[`reducers utils observeChanges shoud be the same - returns false 9`] = `false`;
|
||||
|
||||
exports[`reducers utils observeChanges shoud be the same - returns false 10`] = `false`;
|
||||
|
||||
exports[`reducers utils observeChanges shoul NOT be the same - returns true 1`] = `true`;
|
||||
|
||||
exports[`reducers utils observeChanges shoul NOT be the same - returns true 2`] = `true`;
|
||||
@ -35,3 +37,5 @@ exports[`reducers utils observeChanges shoul NOT be the same - returns true 7`]
|
||||
exports[`reducers utils observeChanges shoul NOT be the same - returns true 8`] = `true`;
|
||||
|
||||
exports[`reducers utils observeChanges shoul NOT be the same - returns true 9`] = `true`;
|
||||
|
||||
exports[`reducers utils observeChanges shoul NOT be the same - returns true 10`] = `true`;
|
||||
|
@ -16,6 +16,10 @@ describe('reducers utils', () => {
|
||||
pervious: [],
|
||||
current: [],
|
||||
},
|
||||
{
|
||||
pervious: [1, 1, 1],
|
||||
current: [1, 1, 1],
|
||||
},
|
||||
{
|
||||
pervious: 'a',
|
||||
current: 'a',
|
||||
@ -57,9 +61,13 @@ describe('reducers utils', () => {
|
||||
current: {},
|
||||
},
|
||||
{
|
||||
pervious: [{}],
|
||||
pervious: [{}, {}],
|
||||
current: [],
|
||||
},
|
||||
{
|
||||
pervious: [1, 1, 1],
|
||||
current: [1, 1],
|
||||
},
|
||||
{
|
||||
pervious: 'a',
|
||||
current: 'b',
|
||||
|
@ -122,7 +122,7 @@ export const observeChanges = (prev: ?Object, current: ?Object, filter?: {[k: st
|
||||
// 2. one of the objects is null/undefined
|
||||
if (!prev || !current) return true;
|
||||
|
||||
const prevType = Object.prototype.toString.call(current);
|
||||
const prevType = Object.prototype.toString.call(prev);
|
||||
const currentType = Object.prototype.toString.call(current);
|
||||
// 3. one of the objects has different type then other
|
||||
if (prevType !== currentType) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user