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 16import { HeapNodeToConstructorItem } from "../../../src/js-heap/utils/Utils.js"; 17import {HeapNode} from "../../../src/js-heap/model/DatabaseStruct.js"; 18jest.mock('../../../src/js-heap/model/DatabaseStruct', () => {}); 19 20jest.mock('../../../src/js-heap/HeapDataInterface', () => { 21 return {}; 22}); 23jest.mock('../../../src/js-heap/model/DatabaseStruct', () => {}); 24 25describe('Utils Test', () => { 26 it('HeapNodeToConstructorItemTest01', () => { 27 let data = { 28 fileId: 1, 29 nodeIndex: 1, 30 nodeOldIndex: 1, 31 type: '', 32 name: '', 33 id: 1, 34 selfSize: 1, 35 edgeCount: 1, 36 traceNodeId: 1, 37 detachedness: 1, 38 edges: '', 39 distance: -5, 40 retainedSize: 1, 41 displayName: '', 42 firstEdgeIndex: 1, 43 flag: 1, 44 retainsCount: 0, 45 retainsEdgeIdx: [], 46 retainsNodeIdx: [], 47 } 48 // @ts-ignore 49 data.nodeName = jest.fn(() => 'test'); 50 HeapNodeToConstructorItem(data); 51 }); 52}) 53