10000 Test convert to record · ui-frontend/immutable-js@55d6c5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 55d6c5f

Browse files
committed
Test convert to record
1 parent 3546268 commit 55d6c5f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

__tests__/Conversion.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ describe('Conversion', () => {
4545
list: [1, 2, 3]
4646
};
4747

48+
var Point = Immutable.Record({x:0, y:0});
49+
4850
var immutableData = Map({
4951
deepList: Vector(
5052
Map({
@@ -82,7 +84,7 @@ describe('Conversion', () => {
8284
a: "A",
8385
b: "B"
8486
}),
85-
point: OrderedMap({x: 10, y: 20}),
87+
point: new Point({x: 10, y: 20}),
8688
string: "Hello",
8789
list: Vector(1, 2, 3)
8890
});
@@ -93,6 +95,9 @@ describe('Conversion', () => {
9395

9496
it('Converts deep JSON with custom conversion', () => {
9597
var seq = Immutable.fromJSON 5CE9 (js, function (key, sequence) {
98+
if (key === 'point') {
99+
return new Point(sequence);
100+
}
96101
return Array.isArray(this[key]) ? sequence.toVector() : sequence.toOrderedMap();
97102
});
98103
expect(seq).is(immutableOrderedData);

0 commit comments

Comments
 (0)
0