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