1import { paramMock } from "./utils" 2 3export function mockUserauth() { 4 global.systemplugin.userIAM = {} 5 const AuthenticatorMock = { 6 execuate: function (...args) { 7 console.warn("Authenticator.execuate interface mocked in the Previewer. How this interface works on the" + 8 " Previewer 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.paramNumberMock); 15 }) 16 } 17 } 18 } 19 global.systemplugin.userIAM.userAuth = { 20 getAuthenticator: function (...args) { 21 console.warn("userIAM.userAuth.getAuthenticator interface mocked in the Previewer. How this interface works on" + 22 " the Previewer may be different from that on a real device.") 23 return AuthenticatorMock; 24 } 25 } 26}