@@ -12,6 +12,7 @@ describe('mainReducer testing', () => {
12
12
state = {
13
13
tabs : {
14
14
87 : {
15
+ initialSnapshot : [ ] ,
15
16
snapshots : [ 1 , 2 , 3 , 4 ] ,
16
17
sliderIndex : 2 ,
17
18
viewIndex : - 1 ,
@@ -23,10 +24,67 @@ describe('mainReducer testing', () => {
23
24
intervalId : 87 ,
24
25
playing : true ,
25
26
index : 3 ,
26
- hierarchy : null , // should be a linked list with four nodes
27
- currLocation : null , // should point to the last node in hierarchy
27
+ initialHierarchy : null ,
28
+ // should be a linked list with four nodes
29
+ hierarchy : {
30
+ index : 0 ,
31
+ name : 1 ,
32
+ branch : 0 ,
33
+ stateSnapshot : {
34
+ state : { } ,
35
+ children : [ {
36
+ state : { test : 'test' } ,
37
+ name : 'App' ,
38
+ componentData : { actualDuration : 3.5 } ,
39
+ } ] ,
40
+ } ,
41
+ children : [ {
42
+ index : 1 ,
43
+ name : 2 ,
44
+ branch : 0 ,
45
+ stateSnapshot : {
46
+ state : { } ,
47
+ children : [ {
48
+ state : { test : 'test' } ,
49
+ name : 'App' ,
50
+ componentData : { actualDuration : 3.5 } ,
51
+ } ] ,
52
+ } ,
53
+ children : [ {
54
+ index : 2 ,
55
+ name : 3 ,
56
+ branch : 0 ,
57
+ stateSnapshot : {
58
+ state : { } ,
59
+ children : [ {
60
+ state : { test : 'test' } ,
61
+ name : 'App' ,
62
+ componentData : { actualDuration : 3.5 } ,
63
+ } ] ,
64
+ } ,
65
+ children : [ {
66
+ index : 3 ,
67
+ name : 4 ,
68
+ branch : 0 ,
69
+ stateSnapshot : {
70
+ state : { } ,
71
+ children : [ {
72
+ state : { test : 'test' } ,
73
+ name : 'App' ,
74
+ componentData : { actualDuration : 3.5 } ,
75
+ } ] ,
76
+ } ,
77
+ children : [ ] ,
78
+ } ] ,
79
+ } ] ,
80
+ } ] ,
81
+ } ,
82
+ // currLocation: null,
83
+ // should point to the last node in hierarchy
84
+ currLocation : 4 ,
28
85
} ,
29
86
75 : {
87
+ initialSnapshot : [ ] ,
30
88
snapshots : [ 1 , 2 , 3 , 4 ] ,
31
89
sliderIndex : 3 ,
32
90
viewIndex : - 1 ,
@@ -37,6 +95,64 @@ describe('mainReducer testing', () => {
37
95
} ,
38
96
intervalId : 75 ,
39
97
playing : false ,
98
+ initialHierarchy : null ,
99
+ // should be a linked list with four nodes
100
+ hierarchy : {
101
+ index : 0 ,
102
+ name : 1 ,
103
+ branch : 0 ,
104
+ stateSnapshot : {
105
+ state : { } ,
106
+ children : [ {
107
+ state : { test : 'test' } ,
108
+ name : 'App' ,
109
+ componentData : { actualDuration : 3.5 } ,
110
+ } ] ,
111
+ } ,
112
+ children : [ {
113
+ index : 1 ,
114
+ name : 2 ,
115
+ branch : 0 ,
116
+ stateSnapshot : {
117
+ state : { } ,
118
+ children : [ {
119
+ state : { test : 'test' } ,
120
+ name : 'App' ,
121
+ componentData : { actualDuration : 3.5 } ,
122
+ } ] ,
123
+ } ,
124
+ children : [ {
125
+ index : 2 ,
126
+ name : 3 ,
127
+ branch : 0 ,
128
+ stateSnapshot : {
129
+ state : { } ,
130
+ children : [ {
131
+ state : { test : 'test' } ,
132
+ name : 'App' ,
133
+ componentData : { actualDuration : 3.5 } ,
134
+ } ] ,
135
+ } ,
136
+ children : [ {
137
+ index : 3 ,
138
+ name : 4 ,
139
+ branch : 0 ,
140
+ stateSnapshot : {
141
+ state : { } ,
142
+ children : [ {
143
+ state : { test : 'test' } ,
144
+ name : 'App' ,
145
+ componentData : { actualDuration : 3.5 } ,
146
+ } ] ,
147
+ } ,
148
+ children : [ ] ,
149
+ } ] ,
150
+ } ] ,
151
+ } ] ,
152
+ } ,
153
+ // currLocation: null,
154
+ // should point to the last node in hierarchy
155
+ currLocation : 4 ,
40
156
} ,
41
157
} ,
42
158
currentTab : 87 ,
@@ -100,7 +216,7 @@ describe('mainReducer testing', () => {
100
216
expect ( mainReducer ( state , emptySnapshots ( ) ) . tabs [ currentTab ] . viewIndex ) . toEqual ( - 1 ) ;
101
217
expect ( mainReducer ( state , emptySnapshots ( ) ) . tabs [ currentTab ] . playing ) . toEqual ( false ) ;
102
218
expect ( mainReducer ( state , emptySnapshots ( ) ) . tabs [ currentTab ]
103
- . snapshots ) . toEqual ( state . tabs [ currentTab ] . snapshots . slice ( 0 , 1 ) ) ;
219
+ . snapshots ) . toEqual ( [ state . tabs [ currentTab ] . snapshots [ state . tabs [ currentTab ] . snapshots . length - 1 ] ] ) ;
104
220
} ) ;
105
221
// should push slider back to start position
106
222
} ) ;
0 commit comments