@@ -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 : 'Clothing' , All : 1526 , 'All- Bulgaria' : 774 , 'All- USA' : 296 , 'All- Uruguay' : 456 , level : 1 } ,
58+ { field1 : 'Bikes' , All : 68 , 'All- Uruguay' : 68 , level : 1 } ,
59+ { field1 : 'Accessories' , All : 293 , 'All- USA' : 293 , level : 1 } ,
60+ { field1 : '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 : 'Clothing' , All : 1526 , 'All- Bulgaria' : 774 , 'All- USA' : 296 , 'All- Uruguay' : 456 , level : 1 } ,
64+ { field1 : 'Bikes' , All : 68 , 'All- Uruguay' : 68 , level : 1 } ,
65+ { field1 : 'Accessories' , All : 293 , 'All- USA' : 293 , level : 1 } ,
66+ { field1 : 'Components' , All : 240 , 'All- USA' : 240 , level : 1 }
6767 ] ) ;
6868 } ) ;
6969
@@ -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
@@ -212,53 +212,82 @@ describe('Pivot pipes', () => {
212212 ] ) ;
213213 } ) ;
214214
215- xit ( 'transforms flat data to pivot data multiple row dimensions' , ( ) => {
215+ it ( 'transforms flat data to pivot data multiple row dimensions' , ( ) => {
216216 const rowPipeResult = rowPipe . transform ( data , [ {
217217 member : 'ProductCategory' ,
218218 enabled : true ,
219219 childLevels : [ ]
220220 } ,
221221 {
222- member : Date ,
222+ member : ' Date' ,
223223 enabled : true ,
224224 childLevels : [ ]
225225 } ] , expansionStates , pivotConfigHierarchy . values ) ;
226226
227227 expect ( rowPipeResult ) . toEqual ( [
228228 {
229229 ProductCategory : 'Clothing' ,
230+ Date : '' ,
230231 records : [
231232 {
232- ProductCategory : 'Clothing' ,
233- UnitPrice : 12.81 ,
234- SellerName : 'Stanley' ,
235- Country : 'Bulgaria' ,
236233 Date : '01/01/2021' ,
237- UnitsSold : 282
234+ records : [
235+ {
236+ ProductCategory : 'Clothing' ,
237+ UnitPrice : 12.81 ,
238+ SellerName : 'Stanley' ,
239+ Country : 'Bulgaria' ,
240+ Date : '01/01/2021' ,
241+ UnitsSold : 282
242+ }
243+ ] ,
244+ level : 1 ,
245+ ProductCategory : 'Clothing'
238246 } ,
239247 {
240- ProductCategory : 'Clothing' ,
241- UnitPrice : 49.57 ,
242- SellerName : 'Elisa' ,
243- Country : 'USA' ,
244248 Date : '01/05/2019' ,
245- UnitsSold : 296
249+ records : [
250+ {
251+ ProductCategory : 'Clothing' ,
252+ UnitPrice : 49.57 ,
253+ SellerName : 'Elisa' ,
254+ Country : 'USA' ,
255+ Date : '01/05/2019' ,
256+ UnitsSold : 296
257+ }
258+ ] ,
259+ level : 1 ,
260+ ProductCategory : 'Clothing'
246261 } ,
247262 {
248- ProductCategory : 'Clothing' ,
249- UnitPrice : 68.33 ,
250- SellerName : 'Larry' ,
251- Country : 'Uruguay' ,
252263 Date : '05/12/2020' ,
253- UnitsSold : 456
264+ records : [
265+ {
266+ ProductCategory : 'Clothing' ,
267+ UnitPrice : 68.33 ,
268+ SellerName : 'Larry' ,
269+ Country : 'Uruguay' ,
270+ Date : '05/12/2020' ,
271+ UnitsSold : 456
272+ }
273+ ] ,
274+ level : 1 ,
275+ ProductCategory : 'Clothing'
254276 } ,
255277 {
256- ProductCategory : 'Clothing' ,
257- UnitPrice : 16.05 ,
258- SellerName : 'Walter' ,
259- Country : 'Bulgaria' ,
260278 Date : '02/19/2020' ,
261- UnitsSold : 492
279+ records : [
280+ {
281+ ProductCategory : 'Clothing' ,
282+ UnitPrice : 16.05 ,
283+ SellerName : 'Walter' ,
284+ Country : 'Bulgaria' ,
285+ Date : '02/19/2020' ,
286+ UnitsSold : 492
287+ }
288+ ] ,
289+ level : 1 ,
290+ ProductCategory : 'Clothing'
262291 }
263292 ] ,
264293 level : 0
@@ -325,14 +354,22 @@ describe('Pivot pipes', () => {
325354 } ,
326355 {
327356 ProductCategory : 'Bikes' ,
357+ Date : '' ,
328358 records : [
329359 {
330- ProductCategory : 'Bikes' ,
331- UnitPrice : 3.56 ,
332- SellerName : 'Lydia' ,
333- Country : 'Uruguay' ,
334360 Date : '01/06/2020' ,
335- UnitsSold : 68
361+ records : [
362+ {
363+ ProductCategory : 'Bikes' ,
364+ UnitPrice : 3.56 ,
365+ SellerName : 'Lydia' ,
366+ Country : 'Uruguay' ,
367+ Date : '01/06/2020' ,
368+ UnitsSold : 68
369+ }
370+ ] ,
371+ level : 1 ,
372+ ProductCategory : 'Bikes'
336373 }
337374 ] ,
338375 level : 0
@@ -354,14 +391,22 @@ describe('Pivot pipes', () => {
354391 } ,
355392 {
356393 ProductCategory : 'Accessories' ,
394+ Date : '' ,
357395 records : [
358396 {
359- ProductCategory : 'Accessories' ,
360- UnitPrice : 85.58 ,
361- SellerName : 'David' ,
362- Country : 'USA' ,
363397 Date : '04/07/2021' ,
364- UnitsSold : 293
398+ records : [
399+ {
400+ ProductCategory : 'Accessories' ,
401+ UnitPrice : 85.58 ,
402+ SellerName : 'David' ,
403+ Country : 'USA' ,
404+ Date : '04/07/2021' ,
405+ UnitsSold : 293
406+ }
407+ ] ,
408+ level : 1 ,
409+ ProductCategory : 'Accessories'
365410 }
366411 ] ,
367412 level : 0
@@ -383,14 +428,22 @@ describe('Pivot pipes', () => {
383428 } ,
384429 {
385430 ProductCategory : 'Components' ,
431+ Date : '' ,
386432 records : [
387433 {
388- ProductCategory : 'Components' ,
389- UnitPrice : 18.13 ,
390- SellerName : 'John' ,
391- Country : 'USA' ,
392434 Date : '12/08/2021' ,
393- UnitsSold : 240
435+ records : [
436+ {
437+ ProductCategory : 'Components' ,
438+ UnitPrice : 18.13 ,
439+ SellerName : 'John' ,
440+ Country : 'USA' ,
441+ Date : '12/08/2021' ,
442+ UnitsSold : 240
443+ }
444+ ] ,
445+ level : 1 ,
446+ ProductCategory : 'Components'
394447 }
395448 ] ,
396449 level : 0
0 commit comments