@@ -72,7 +72,7 @@ describe('Pivot pipes', () => {
72
72
it ( 'transforms flat data to pivot data' , ( ) => {
73
73
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
74
74
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
75
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates ) ;
75
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
76
76
expect ( rowStatePipeResult ) . toEqual ( [
77
77
{ All : 2127 , 'All-Bulgaria' : 774 , 'All-USA' : 829 , 'All-Uruguay' : 524 , AllCategory : 'All' , AllCategory_level : 0 } ,
78
78
{ ProductCategory : 'Clothing' , All : 1526 , 'All-Bulgaria' : 774 , 'All-USA' : 296 , 'All-Uruguay' : 456 , ProductCategory_level : 1 } ,
@@ -175,7 +175,7 @@ describe('Pivot pipes', () => {
175
175
] , level : 0
176
176
} ] ) ;
177
177
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
178
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates ) ;
178
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
179
179
expect ( rowStatePipeResult ) . toEqual ( [
180
180
{
181
181
ProductCategory : 'Clothing' , All : 1526 , 'All-Bulgaria' : 774 , 'All-USA' : 296 ,
@@ -192,7 +192,7 @@ describe('Pivot pipes', () => {
192
192
expanded . set ( 'All' , false ) ;
193
193
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expanded ) ;
194
194
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
195
- const rowPipeCollapseResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expanded ) ;
195
+ const rowPipeCollapseResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expanded , true ) ;
196
196
expect ( rowPipeCollapseResult ) . toEqual ( [
197
197
{
198
198
AllCategory : 'All' ,
@@ -205,7 +205,7 @@ describe('Pivot pipes', () => {
205
205
] ) ;
206
206
207
207
expanded . set ( 'All' , true ) ;
208
- const rowPipeExpandResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expanded ) ;
208
+ const rowPipeExpandResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expanded , true ) ;
209
209
expect ( rowPipeExpandResult ) . toEqual ( [
210
210
{ AllCategory : 'All' , All : 2127 , 'All-Bulgaria' : 774 , 'All-USA' : 829 , 'All-Uruguay' : 524 , AllCategory_level : 0 } ,
211
211
{ ProductCategory : 'Clothing' , All : 1526 , 'All-Bulgaria' : 774 , 'All-USA' : 296 , 'All-Uruguay' : 456 , ProductCategory_level : 1 } ,
@@ -236,7 +236,7 @@ describe('Pivot pipes', () => {
236
236
] ;
237
237
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
238
238
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
239
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates ) ;
239
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
240
240
expect ( rowStatePipeResult ) . toEqual ( [
241
241
{ Date : '01/01/2021' , ProductCategory : 'Clothing' , All : 282 , 'All-Bulgaria' : 282 , ProductCategory_level : 0 , Date_level : 0 } ,
242
242
{ Date : '01/05/2019' , ProductCategory : 'Clothing' , All : 296 , 'All-USA' : 296 , ProductCategory_level : 0 , Date_level : 0 } ,
@@ -268,7 +268,7 @@ describe('Pivot pipes', () => {
268
268
} ] ;
269
269
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
270
270
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
271
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates ) ;
271
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
272
272
expect ( rowStatePipeResult ) . toEqual ( [
273
273
{
274
274
'AllDate' : 'AllDate' , 'AllProd' : 'AllProd' , 'All' : 2127 , 'All-Bulgaria' : 774 , 'All-USA' : 829 , 'All-Uruguay' : 524 , 'AllProd_level' : 0 ,
@@ -363,7 +363,7 @@ describe('Pivot pipes', () => {
363
363
} ] ;
364
364
const rowPipeResult = rowPipe . transform ( data , pivotConfig , new Map < any , boolean > ( ) ) ;
365
365
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
366
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
366
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) , true ) ;
367
367
/* eslint-disable quote-props */
368
368
expect ( rowStatePipeResult ) . toEqual ( [
369
369
{
@@ -404,7 +404,7 @@ describe('Pivot pipes', () => {
404
404
} ] ;
405
405
const rowPipeResult = rowPipe . transform ( data , pivotConfig , new Map < any , boolean > ( ) ) ;
406
406
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
407
- const rowStateResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
407
+ const rowStateResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) , true ) ;
408
408
/* eslint-disable quote-props */
409
409
expect ( rowStateResult ) . toEqual (
410
410
[
@@ -458,7 +458,7 @@ describe('Pivot pipes', () => {
458
458
] ;
459
459
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
460
460
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , expansionStates ) ;
461
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
461
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) , true ) ;
462
462
expect ( rowStatePipeResult ) . toEqual (
463
463
[
464
464
{
@@ -507,7 +507,7 @@ describe('Pivot pipes', () => {
507
507
508
508
const rowPipeResult = rowPipe . transform ( preprocessedData , pivotConfig , new Map < any , boolean > ( ) ) ;
509
509
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
510
- const rowStateResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
510
+ const rowStateResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , new Map < any , boolean > ( ) , true ) ;
511
511
512
512
// same data but expanded
513
513
expect ( rowStateResult ) . toEqual (
@@ -814,7 +814,7 @@ describe('Pivot pipes', () => {
814
814
815
815
const rowPipeResult = rowPipe . transform ( data , pivotConfig , expansionStates ) ;
816
816
const columnPipeResult = columnPipe . transform ( rowPipeResult , pivotConfig , new Map < any , boolean > ( ) ) ;
817
- const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates ) ;
817
+ const rowStatePipeResult = rowStatePipe . transform ( columnPipeResult , pivotConfig , expansionStates , true ) ;
818
818
expect ( rowStatePipeResult . length ) . toEqual ( 31 ) ;
819
819
expect ( rowStatePipeResult [ 0 ] [ 'AllPeriods' ] ) . toEqual ( 'All Periods' ) ;
820
820
expect ( rowStatePipeResult [ 0 ] [ 'AllProducts' ] ) . toEqual ( 'All' ) ;
0 commit comments