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 */ 15import { TabPaneFps } from '../../../../../../src/trace/component/trace/sheet/fps/TabPaneFps'; 16const sqlit = require('../../../../../../src/trace/database/sql/SqlLite.sql'); 17jest.mock('../../../../../../src/trace/database/sql/SqlLite.sql'); 18 19jest.mock('../../../../../../src/trace/component/trace/sheet/SheetUtils', () => { 20 return {}; 21}); 22window.ResizeObserver = 23 window.ResizeObserver || 24 jest.fn().mockImplementation(() => ({ 25 disconnect: jest.fn(), 26 observe: jest.fn(), 27 unobserve: jest.fn(), 28 })); 29 30describe('TabPaneFps Test', () => { 31 let tabPaneFps = new TabPaneFps(); 32 33 it('TabPaneFpsTest01', function () { 34 let mockgetTabFps = sqlit.getTabFps; 35 mockgetTabFps.mockResolvedValue([{ leftNs: 10, rightNs: 10 }]); 36 let a = { rightNs: 1, leftNs: 1 }; 37 expect((tabPaneFps.data = a)).toBeTruthy(); 38 }); 39 40 it('TabPaneFpsTest02', function () { 41 let mockgetTabFps = sqlit.getTabFps; 42 mockgetTabFps.mockResolvedValue([]); 43 let a = { rightNs: 1, leftNs: 1 }; 44 expect((tabPaneFps.data = a)).toBeTruthy(); 45 }); 46}); 47