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 { processMemDataReceiver } from '../../../../../src/trace/database/data-trafic/process/ProcessMemDataReceiver'; 17 18jest.mock('../../../../../src/trace/database/ui-worker/ProcedureWorker', () => { 19 return {}; 20}); 21 22describe('ProcessMemDataReceiver Test', () => { 23 let data = { 24 action: "exec-proto", 25 id: "71", 26 name: 7, 27 params: 28 { 29 endNS: 20000305000, 30 recordEndNS: 168778663166000, 31 recordStartNS: 168758662861000, 32 sharedArrayBuffers: undefined, 33 startNS: 0, 34 t: 1703574363518, 35 trackId: 543, 36 trafic: 3, 37 width: 1407 38 } 39 } 40 let memData = [{ 41 processMemData: { 42 startTime: 7578590000, 43 trackId: 545, 44 ts: 168766241451000, 45 value: 1728 46 } 47 }] 48 it('ProcessMemDataReceiverTest01', async () => { 49 (self as unknown as Worker).postMessage = jest.fn(() => true); 50 expect(processMemDataReceiver(data, () => { 51 return memData; 52 })).toBeUndefined(); 53 }); 54});