!135 本地多用户新增jsAPI,mock增加适配

Merge pull request !135 from 张阿龙/master
This commit is contained in:
openharmony_ci
2022-01-24 14:20:45 +00:00
committed by Gitee
@@ -169,6 +169,18 @@ export function mockOsAccount() {
})
}
},
getOsAccountLocalIdFromDomain: function (...args) {
console.warn("AccountManager.getOsAccountLocalIdFromDomain interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
const len = args.length
if (len > 0 && typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock);
} else {
return new Promise((resolve, reject) => {
resolve(paramMock.paramNumberMock);
})
}
},
queryMaxOsAccountNumber: function (...args) {
console.warn("AccountManager.queryMaxOsAccountNumber interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
@@ -219,6 +231,18 @@ export function mockOsAccount() {
})
}
},
createOsAccountForDomain: function (...args) {
console.warn("AccountManager.createOsAccountForDomain interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
const len = args.length
if (len > 0 && typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, osAccountInfoMock);
} else {
return new Promise((resolve, reject) => {
resolve(osAccountInfoMock);
})
}
},
queryCurrentOsAccount: function (...args) {
console.warn("AccountManager.queryCurrentOsAccount interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
@@ -291,6 +315,30 @@ export function mockOsAccount() {
})
}
},
getOsAccountLocalIdBySerialNumber: function (...args) {
console.warn("AccountManager.getOsAccountLocalIdBySerialNumber interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
const len = args.length
if (len > 0 && typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock);
} else {
return new Promise((resolve, reject) => {
resolve();
})
}
},
getSerialNumberByOsAccountLocalId: function (...args) {
console.warn("AccountManager.getSerialNumberByOsAccountLocalId interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")
const len = args.length
if (len > 0 && typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock);
} else {
return new Promise((resolve, reject) => {
resolve();
})
}
},
on: function (...args) {
console.warn("AccountManager.on interface mocked in the Previewer. " +
"How this interface works on the Previewer may be different from that on a real device.")