@@ -53,17 +53,17 @@ describe('Pivot pipes', () => {
5353 const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfigHierarchy . columns , pivotConfigHierarchy . values ) ;
5454 expect ( columnPipeResult ) . toEqual ( [
5555 {
56- field1 : 'All' , All : 2127 , Bulgaria : 774 , USA : 829 , Uruguay : 524 , level : 0 , records : [
57- { field1 : 'Clothing' , All : 1526 , Bulgaria : 774 , USA : 296 , Uruguay : 456 , level : 1 } ,
58- { field1 : 'Bikes' , All : 68 , Uruguay : 68 , level : 1 } ,
59- { field1 : 'Accessories' , All : 293 , USA : 293 , level : 1 } ,
60- { field1 : 'Components' , All : 240 , USA : 240 , level : 1 }
56+ field1 : 'All' , All : 2127 , 'All- Bulgaria' : 774 , 'All- USA' : 829 , 'All- Uruguay' : 524 , level : 0 , records : [
57+ { field1 : 'All- Clothing' , All : 1526 , 'All- Bulgaria' : 774 , 'All- USA' : 296 , 'All- Uruguay' : 456 , level : 1 } ,
58+ { field1 : 'All- Bikes' , All : 68 , 'All- Uruguay' : 68 , level : 1 } ,
59+ { field1 : 'All- Accessories' , All : 293 , 'All- USA' : 293 , level : 1 } ,
60+ { field1 : 'All- Components' , All : 240 , 'All- USA' : 240 , level : 1 }
6161 ]
6262 } ,
63- { field1 : 'Clothing' , All : 1526 , Bulgaria : 774 , USA : 296 , Uruguay : 456 , level : 1 } ,
64- { field1 : 'Bikes' , All : 68 , Uruguay : 68 , level : 1 } ,
65- { field1 : 'Accessories' , All : 293 , USA : 293 , level : 1 } ,
66- { field1 : 'Components' , All : 240 , USA : 240 , level : 1 }
63+ { field1 : 'All- Clothing' , All : 1526 , 'All- Bulgaria' : 774 , 'All- USA' : 296 , 'All- Uruguay' : 456 , level : 1 } ,
64+ { field1 : 'All- Bikes' , All : 68 , 'All- Uruguay' : 68 , level : 1 } ,
65+ { field1 : 'All- Accessories' , All : 293 , 'All- USA' : 293 , level : 1 } ,
66+ { field1 : 'All- Components' , All : 240 , 'All- USA' : 240 , level : 1 }
6767 ] ) ;
6868 } ) ;
6969
@@ -75,7 +75,7 @@ describe('Pivot pipes', () => {
7575 } ] , expansionStates , pivotConfigHierarchy . values ) ;
7676 expect ( rowPipeResult ) . toEqual ( [
7777 {
78- ProductCategory : 'Clothing' , level : 0 , records : [
78+ ProductCategory : 'Clothing' , level : 0 , records : [
7979 { ProductCategory : 'Clothing' , UnitPrice : 12.81 , SellerName : 'Stanley' , Country : 'Bulgaria' , Date : '01/01/2021' , UnitsSold : 282 } ,
8080 { ProductCategory : 'Clothing' , UnitPrice : 49.57 , SellerName : 'Elisa' , Country : 'USA' , Date : '01/05/2019' , UnitsSold : 296 } ,
8181 { ProductCategory : 'Clothing' , UnitPrice : 68.33 , SellerName : 'Larry' , Country : 'Uruguay' , Date : '05/12/2020' , UnitsSold : 456 } ,
@@ -99,10 +99,10 @@ describe('Pivot pipes', () => {
9999 ] ) ;
100100 const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfigHierarchy . columns , pivotConfigHierarchy . values ) ;
101101 expect ( columnPipeResult ) . toEqual ( [
102- { ProductCategory : 'Clothing' , All : 1526 , Bulgaria : 774 , USA : 296 , Uruguay : 456 , level : 0 } ,
103- { ProductCategory : 'Bikes' , All : 68 , Uruguay : 68 , level : 0 } ,
104- { ProductCategory : 'Accessories' , All : 293 , USA : 293 , level : 0 } ,
105- { ProductCategory : 'Components' , All : 240 , USA : 240 , level : 0 }
102+ { ProductCategory : 'Clothing' , All : 1526 , 'All- Bulgaria' : 774 , 'All- USA' : 296 , 'All- Uruguay' : 456 , level : 0 } ,
103+ { ProductCategory : 'Bikes' , All : 68 , 'All- Uruguay' : 68 , level : 0 } ,
104+ { ProductCategory : 'Accessories' , All : 293 , 'All- USA' : 293 , level : 0 } ,
105+ { ProductCategory : 'Components' , All : 240 , 'All- USA' : 240 , level : 0 }
106106 ] ) ;
107107 } ) ;
108108
@@ -113,7 +113,7 @@ describe('Pivot pipes', () => {
113113 expect ( rowPipeCollapseResult ) . toEqual ( [
114114 { field1 :'All' , records : [
115115 {
116- field1 :'Clothing' ,
116+ field1 :'All- Clothing' ,
117117 records :[
118118 { ProductCategory :'Clothing' , UnitPrice :12.81 , SellerName :'Stanley' , Country :'Bulgaria' , Date :'01/01/2021' , UnitsSold :282 } ,
119119 { ProductCategory :'Clothing' , UnitPrice :49.57 , SellerName :'Elisa' , Country :'USA' , Date :'01/05/2019' , UnitsSold :296 } ,
@@ -123,20 +123,20 @@ describe('Pivot pipes', () => {
123123 , level :1
124124 } ,
125125 {
126- field1 :'Bikes' ,
126+ field1 :'All- Bikes' ,
127127 records :[
128128 { ProductCategory :'Bikes' , UnitPrice :3.56 , SellerName :'Lydia' , Country :'Uruguay' , Date :'01/06/2020' , UnitsSold :68 }
129129 ]
130130 , level :1
131131 } ,
132132 {
133- field1 :'Accessories' ,
133+ field1 :'All- Accessories' ,
134134 records :[
135135 { ProductCategory :'Accessories' , UnitPrice :85.58 , SellerName :'David' , Country :'USA' , Date :'04/07/2021' , UnitsSold :293 }
136136 ]
137137 , level :1 } ,
138138 {
139- field1 :'Components' ,
139+ field1 :'All- Components' ,
140140 records :[
141141 { ProductCategory :'Components' , UnitPrice :18.13 , SellerName :'John' , Country :'USA' , Date :'12/08/2021' , UnitsSold :240 }
142142 ]
@@ -150,7 +150,7 @@ describe('Pivot pipes', () => {
150150 expect ( rowPipeExpandResult ) . toEqual ( [
151151 { field1 :'All' , records : [
152152 {
153- field1 :'Clothing' ,
153+ field1 :'All- Clothing' ,
154154 records :[
155155 { ProductCategory :'Clothing' , UnitPrice :12.81 , SellerName :'Stanley' , Country :'Bulgaria' , Date :'01/01/2021' , UnitsSold :282 } ,
156156 { ProductCategory :'Clothing' , UnitPrice :49.57 , SellerName :'Elisa' , Country :'USA' , Date :'01/05/2019' , UnitsSold :296 } ,
@@ -160,28 +160,28 @@ describe('Pivot pipes', () => {
160160 , level :1
161161 } ,
162162 {
163- field1 :'Bikes' ,
163+ field1 :'All- Bikes' ,
164164 records :[
165165 { ProductCategory :'Bikes' , UnitPrice :3.56 , SellerName :'Lydia' , Country :'Uruguay' , Date :'01/06/2020' , UnitsSold :68 }
166166 ]
167167 , level :1
168168 } ,
169169 {
170- field1 :'Accessories' ,
170+ field1 :'All- Accessories' ,
171171 records :[
172172 { ProductCategory :'Accessories' , UnitPrice :85.58 , SellerName :'David' , Country :'USA' , Date :'04/07/2021' , UnitsSold :293 }
173173 ]
174174 , level :1 } ,
175175 {
176- field1 :'Components' ,
176+ field1 :'All- Components' ,
177177 records :[
178178 { ProductCategory :'Components' , UnitPrice :18.13 , SellerName :'John' , Country :'USA' , Date :'12/08/2021' , UnitsSold :240 }
179179 ]
180180 , level :1 }
181181 ]
182182 , level :0 } ,
183183 {
184- field1 :'Clothing' ,
184+ field1 :'All- Clothing' ,
185185 records :[
186186 { ProductCategory :'Clothing' , UnitPrice :12.81 , SellerName :'Stanley' , Country :'Bulgaria' , Date :'01/01/2021' , UnitsSold :282 } ,
187187 { ProductCategory :'Clothing' , UnitPrice :49.57 , SellerName :'Elisa' , Country :'USA' , Date :'01/05/2019' , UnitsSold :296 } ,
@@ -191,20 +191,20 @@ describe('Pivot pipes', () => {
191191 , level :1
192192 } ,
193193 {
194- field1 :'Bikes' ,
194+ field1 :'All- Bikes' ,
195195 records :[
196196 { ProductCategory :'Bikes' , UnitPrice :3.56 , SellerName :'Lydia' , Country :'Uruguay' , Date :'01/06/2020' , UnitsSold :68 }
197197 ]
198198 , level :1
199199 } ,
200200 {
201- field1 :'Accessories' ,
201+ field1 :'All- Accessories' ,
202202 records :[
203203 { ProductCategory :'Accessories' , UnitPrice :85.58 , SellerName :'David' , Country :'USA' , Date :'04/07/2021' , UnitsSold :293 }
204204 ]
205205 , level :1 } ,
206206 {
207- field1 :'Components' ,
207+ field1 :'All- Components' ,
208208 records :[
209209 { ProductCategory :'Components' , UnitPrice :18.13 , SellerName :'John' , Country :'USA' , Date :'12/08/2021' , UnitsSold :240 }
210210 ]
@@ -290,19 +290,19 @@ describe('Pivot pipes', () => {
290290 /* eslint-disable quote-props */
291291 expect ( columnPipeResult ) . toEqual ( [
292292 { 'field1' :'All' , 'records' :[
293- { 'field1' :'Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-01/01/2021' :282 ,
293+ { 'field1' :'All- Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-01/01/2021' :282 ,
294294 'Bulgaria-02/19/2020' :492 , 'USA' :296 , 'USA-01/05/2019' :296 , 'Uruguay' :456 , 'Uruguay-05/12/2020' :456 } ,
295- { 'field1' :'Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-01/06/2020' :68 } ,
296- { 'field1' :'Accessories' , 'level' :1 , 'USA' :293 , 'USA-04/07/2021' :293 } ,
297- { 'field1' :'Components' , 'level' :1 , 'USA' :240 , 'USA-12/08/2021' :240 } ]
295+ { 'field1' :'All- Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-01/06/2020' :68 } ,
296+ { 'field1' :'All- Accessories' , 'level' :1 , 'USA' :293 , 'USA-04/07/2021' :293 } ,
297+ { 'field1' :'All- Components' , 'level' :1 , 'USA' :240 , 'USA-12/08/2021' :240 } ]
298298 , 'level' :0 , 'Bulgaria' :774 , 'Bulgaria-01/01/2021' :282 , 'Bulgaria-02/19/2020' :492 ,
299299 'USA' :829 , 'USA-01/05/2019' :296 , 'USA-04/07/2021' :293 , 'USA-12/08/2021' :240 ,
300300 'Uruguay' :524 , 'Uruguay-05/12/2020' :456 , 'Uruguay-01/06/2020' :68 } ,
301- { 'field1' :'Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-01/01/2021' :282 ,
301+ { 'field1' :'All- Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-01/01/2021' :282 ,
302302 'Bulgaria-02/19/2020' :492 , 'USA' :296 , 'USA-01/05/2019' :296 , 'Uruguay' :456 , 'Uruguay-05/12/2020' :456 } ,
303- { 'field1' :'Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-01/06/2020' :68 } ,
304- { 'field1' :'Accessories' , 'level' :1 , 'USA' :293 , 'USA-04/07/2021' :293 } ,
305- { 'field1' :'Components' , 'level' :1 , 'USA' :240 , 'USA-12/08/2021' :240 } ] ) ;
303+ { 'field1' :'All- Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-01/06/2020' :68 } ,
304+ { 'field1' :'All- Accessories' , 'level' :1 , 'USA' :293 , 'USA-04/07/2021' :293 } ,
305+ { 'field1' :'All- Components' , 'level' :1 , 'USA' :240 , 'USA-12/08/2021' :240 } ] ) ;
306306 } ) ;
307307
308308 it ( 'transforms flat data to pivot data 3 column dimensions' , ( ) => {
@@ -326,23 +326,23 @@ describe('Pivot pipes', () => {
326326 expect ( columnPipeResult ) . toEqual ( [
327327 { 'field1' :'All' , 'records' :
328328 [
329- { 'field1' :'Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-Stanley' :282 , 'Bulgaria-Stanley-01/01/2021' :282 ,
329+ { 'field1' :'All- Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-Stanley' :282 , 'Bulgaria-Stanley-01/01/2021' :282 ,
330330 'Bulgaria-Walter' :492 , 'Bulgaria-Walter-02/19/2020' :492 , 'USA' :296 , 'USA-Elisa' :296 , 'USA-Elisa-01/05/2019' :296 ,
331331 'Uruguay' :456 , 'Uruguay-Larry' :456 , 'Uruguay-Larry-05/12/2020' :456 } ,
332- { 'field1' :'Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-Lydia' :68 , 'Uruguay-Lydia-01/06/2020' :68 } ,
333- { 'field1' :'Accessories' , 'level' :1 , 'USA' :293 , 'USA-David' :293 , 'USA-David-04/07/2021' :293 } ,
334- { 'field1' :'Components' , 'level' :1 , 'USA' :240 , 'USA-John' :240 , 'USA-John-12/08/2021' :240 }
332+ { 'field1' :'All- Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-Lydia' :68 , 'Uruguay-Lydia-01/06/2020' :68 } ,
333+ { 'field1' :'All- Accessories' , 'level' :1 , 'USA' :293 , 'USA-David' :293 , 'USA-David-04/07/2021' :293 } ,
334+ { 'field1' :'All- Components' , 'level' :1 , 'USA' :240 , 'USA-John' :240 , 'USA-John-12/08/2021' :240 }
335335 ] ,
336336 'level' :0 , 'Bulgaria' :774 , 'Bulgaria-Stanley' :282 , 'Bulgaria-Stanley-01/01/2021' :282 , 'Bulgaria-Walter' :492 ,
337337 'Bulgaria-Walter-02/19/2020' :492 , 'USA' :829 , 'USA-Elisa' :296 , 'USA-Elisa-01/05/2019' :296 , 'USA-David' :293 ,
338338 'USA-David-04/07/2021' :293 , 'USA-John' :240 , 'USA-John-12/08/2021' :240 , 'Uruguay' :524 , 'Uruguay-Larry' :456 ,
339339 'Uruguay-Larry-05/12/2020' :456 , 'Uruguay-Lydia' :68 , 'Uruguay-Lydia-01/06/2020' :68 } ,
340- { 'field1' :'Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-Stanley' :282 , 'Bulgaria-Stanley-01/01/2021' :282 ,
340+ { 'field1' :'All- Clothing' , 'level' :1 , 'Bulgaria' :774 , 'Bulgaria-Stanley' :282 , 'Bulgaria-Stanley-01/01/2021' :282 ,
341341 'Bulgaria-Walter' :492 , 'Bulgaria-Walter-02/19/2020' :492 , 'USA' :296 , 'USA-Elisa' :296 , 'USA-Elisa-01/05/2019' :296 , 'Uruguay' :456 ,
342342 'Uruguay-Larry' :456 , 'Uruguay-Larry-05/12/2020' :456 } ,
343- { 'field1' :'Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-Lydia' :68 , 'Uruguay-Lydia-01/06/2020' :68 } ,
344- { 'field1' :'Accessories' , 'level' :1 , 'USA' :293 , 'USA-David' :293 , 'USA-David-04/07/2021' :293 } ,
345- { 'field1' :'Components' , 'level' :1 , 'USA' :240 , 'USA-John' :240 , 'USA-John-12/08/2021' :240 }
343+ { 'field1' :'All- Bikes' , 'level' :1 , 'Uruguay' :68 , 'Uruguay-Lydia' :68 , 'Uruguay-Lydia-01/06/2020' :68 } ,
344+ { 'field1' :'All- Accessories' , 'level' :1 , 'USA' :293 , 'USA-David' :293 , 'USA-David-04/07/2021' :293 } ,
345+ { 'field1' :'All- Components' , 'level' :1 , 'USA' :240 , 'USA-John' :240 , 'USA-John-12/08/2021' :240 }
346346 ] ) ;
347347 } ) ;
348348} ) ;
0 commit comments