1import { paramMock } from "./utils" 2 3export function mockCall() { 4 global.systemplugin.telephony = {} 5 global.systemplugin.telephony.call = { 6 dial: function (...args) { 7 console.warn("telephony.call.dial interface mocked in the Previewer. How this interface works on the Previewer" + 8 " may be different from that on a real device.") 9 const len = args.length 10 if (typeof args[len - 1] === 'function') { 11 args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); 12 } else { 13 return new Promise((resolve, reject) => { 14 resolve(paramMock.paramBooleanMock); 15 }) 16 } 17 } 18 } 19}