mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 06:00:07 +03:00
Update map2tree.spec.ts
This commit is contained in:
parent
6d3d4c2682
commit
ba4dbd70c8
|
@ -1,15 +1,15 @@
|
||||||
import { map2tree, Node } from '../src';
|
import { map2tree, Node } from '../src';
|
||||||
import * as immutable from 'immutable';
|
import * as immutable from 'immutable';
|
||||||
|
|
||||||
test('# rootNodeKey', () => {
|
test('rootNodeKey', () => {
|
||||||
const map = {};
|
const map = {};
|
||||||
const options = { key: 'foo' };
|
const options = { key: 'foo' };
|
||||||
|
|
||||||
expect((map2tree(map, options) as Node).name).toBe('foo');
|
expect((map2tree(map, options) as Node).name).toBe('foo');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('# shallow map', () => {
|
describe('shallow map', () => {
|
||||||
test('## null', () => {
|
test('null', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: null,
|
a: null,
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ describe('# shallow map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## value', () => {
|
test('value', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: 'foo',
|
a: 'foo',
|
||||||
b: 'bar',
|
b: 'bar',
|
||||||
|
@ -41,7 +41,7 @@ describe('# shallow map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## object', () => {
|
test('object', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: { aa: 'foo' },
|
a: { aa: 'foo' },
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ describe('# shallow map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## immutable Map', () => {
|
test('immutable Map', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: immutable.fromJS({ aa: 'foo', ab: 'bar' }),
|
a: immutable.fromJS({ aa: 'foo', ab: 'bar' }),
|
||||||
};
|
};
|
||||||
|
@ -77,8 +77,8 @@ describe('# shallow map', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('# deep map', () => {
|
describe('deep map', () => {
|
||||||
test('## null', () => {
|
test('null', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: { aa: null },
|
a: { aa: null },
|
||||||
};
|
};
|
||||||
|
@ -102,7 +102,7 @@ describe('# deep map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## object', () => {
|
test('object', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: { aa: { aaa: 'foo' } },
|
a: { aa: { aaa: 'foo' } },
|
||||||
};
|
};
|
||||||
|
@ -127,12 +127,12 @@ describe('# deep map', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('# array map', () => {
|
describe('array map', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: [1, 2],
|
a: [1, 2],
|
||||||
};
|
};
|
||||||
|
|
||||||
test('## push', () => {
|
test('push', () => {
|
||||||
const expected = {
|
const expected = {
|
||||||
name: 'state',
|
name: 'state',
|
||||||
children: [
|
children: [
|
||||||
|
@ -150,7 +150,7 @@ describe('# array map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## unshift', () => {
|
test('unshift', () => {
|
||||||
const options = { pushMethod: 'unshift' as const };
|
const options = { pushMethod: 'unshift' as const };
|
||||||
const expected = {
|
const expected = {
|
||||||
name: 'state',
|
name: 'state',
|
||||||
|
@ -169,7 +169,7 @@ describe('# array map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map), options)).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map), options)).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## null', () => {
|
test('null', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: [null],
|
a: [null],
|
||||||
};
|
};
|
||||||
|
@ -189,8 +189,8 @@ describe('# array map', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('# collection map', () => {
|
describe('collection map', () => {
|
||||||
test('## value', () => {
|
test('value', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: [{ aa: 1 }, { aa: 2 }],
|
a: [{ aa: 1 }, { aa: 2 }],
|
||||||
};
|
};
|
||||||
|
@ -212,7 +212,7 @@ describe('# collection map', () => {
|
||||||
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
expect(map2tree(immutable.fromJS(map))).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('## object', () => {
|
test('object', () => {
|
||||||
const map = {
|
const map = {
|
||||||
a: [{ aa: { aaa: 'foo' } }],
|
a: [{ aa: { aaa: 'foo' } }],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user