test_census-tree-node-01.js (1308B)
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 `internalType` breakdown. 7 */ 8 9 const BREAKDOWN = { 10 by: "internalType", 11 then: { by: "count", count: true, bytes: true }, 12 }; 13 14 const REPORT = { 15 JSObject: { 16 bytes: 100, 17 count: 10, 18 }, 19 "js::Shape": { 20 bytes: 500, 21 count: 50, 22 }, 23 JSString: { 24 bytes: 10, 25 count: 1, 26 }, 27 }; 28 29 const EXPECTED = { 30 name: null, 31 bytes: 0, 32 totalBytes: 610, 33 count: 0, 34 totalCount: 61, 35 children: [ 36 { 37 name: "js::Shape", 38 bytes: 500, 39 totalBytes: 500, 40 count: 50, 41 totalCount: 50, 42 children: undefined, 43 id: 3, 44 parent: 1, 45 reportLeafIndex: 2, 46 }, 47 { 48 name: "JSObject", 49 bytes: 100, 50 totalBytes: 100, 51 count: 10, 52 totalCount: 10, 53 children: undefined, 54 id: 2, 55 parent: 1, 56 reportLeafIndex: 1, 57 }, 58 { 59 name: "JSString", 60 bytes: 10, 61 totalBytes: 10, 62 count: 1, 63 totalCount: 1, 64 children: undefined, 65 id: 4, 66 parent: 1, 67 reportLeafIndex: 3, 68 }, 69 ], 70 id: 1, 71 parent: undefined, 72 reportLeafIndex: undefined, 73 }; 74 75 function run_test() { 76 compareCensusViewData(BREAKDOWN, REPORT, EXPECTED); 77 }