1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16// @ts-ignore 17import { HeapNodeToConstructorItem } from "../../../dist/js-heap/utils/Utils.js"; 18// @ts-ignore 19import {HeapNode} from "../../../dist/js-heap/model/DatabaseStruct.js"; 20jest.mock('../../../dist/js-heap/model/DatabaseStruct.js', () => {}); 21 22jest.mock('../../../dist/js-heap/HeapDataInterface.js', () => { 23 return {}; 24}); 25jest.mock('../../../dist/js-heap/model/DatabaseStruct.js', () => {}); 26 27describe('Utils Test', () => { 28 it('HeapNodeToConstructorItemTest01', () => { 29 let data = { 30 fileId: 1, 31 nodeIndex: 1, 32 nodeOldIndex: 1, 33 type: '', 34 name: '', 35 id: 1, 36 selfSize: 1, 37 edgeCount: 1, 38 traceNodeId: 1, 39 detachedness: 1, 40 edges: '', 41 distance: -5, 42 retainedSize: 1, 43 displayName: '', 44 firstEdgeIndex: 1, 45 flag: 1, 46 retainsCount: 0, 47 retainsEdgeIdx: [], 48 retainsNodeIdx: [], 49 } 50 // @ts-ignore 51 data.nodeName = jest.fn(() => 'test'); 52 HeapNodeToConstructorItem(data); 53 }); 54})