test_census-tree-node-03.js (1937B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 "use strict"; 4 5 /** 6 * Tests CensusTreeNode with `objectClass` breakdown. 7 */ 8 9 const countBreakdown = { by: "count", count: true, bytes: true }; 10 11 const BREAKDOWN = { 12 by: "objectClass", 13 then: countBreakdown, 14 other: { by: "internalType", then: countBreakdown }, 15 }; 16 17 const REPORT = { 18 Function: { bytes: 10, count: 10 }, 19 Array: { bytes: 100, count: 1 }, 20 other: { 21 "JIT::CODE::NOW!!!": { bytes: 20, count: 2 }, 22 "JIT::CODE::LATER!!!": { bytes: 40, count: 4 }, 23 }, 24 }; 25 26 const EXPECTED = { 27 name: null, 28 count: 0, 29 totalCount: 17, 30 bytes: 0, 31 totalBytes: 170, 32 children: [ 33 { 34 name: "Array", 35 bytes: 100, 36 totalBytes: 100, 37 count: 1, 38 totalCount: 1, 39 children: undefined, 40 id: 3, 41 parent: 1, 42 reportLeafIndex: 2, 43 }, 44 { 45 name: "other", 46 count: 0, 47 totalCount: 6, 48 bytes: 0, 49 totalBytes: 60, 50 children: [ 51 { 52 name: "JIT::CODE::LATER!!!", 53 bytes: 40, 54 totalBytes: 40, 55 count: 4, 56 totalCount: 4, 57 children: undefined, 58 id: 6, 59 parent: 4, 60 reportLeafIndex: 5, 61 }, 62 { 63 name: "JIT::CODE::NOW!!!", 64 bytes: 20, 65 totalBytes: 20, 66 count: 2, 67 totalCount: 2, 68 children: undefined, 69 id: 5, 70 parent: 4, 71 reportLeafIndex: 4, 72 }, 73 ], 74 id: 4, 75 parent: 1, 76 reportLeafIndex: undefined, 77 }, 78 { 79 name: "Function", 80 bytes: 10, 81 totalBytes: 10, 82 count: 10, 83 totalCount: 10, 84 children: undefined, 85 id: 2, 86 parent: 1, 87 reportLeafIndex: 1, 88 }, 89 ], 90 id: 1, 91 parent: undefined, 92 reportLeafIndex: undefined, 93 }; 94 95 function run_test() { 96 compareCensusViewData(BREAKDOWN, REPORT, EXPECTED); 97 }