Signed-off-by: hanlu <hanlu1@huawei.com>
This commit is contained in:
hanlu 2023-05-15 11:23:39 +08:00
parent ff702cf61d
commit 4a768ab17f

View File

@ -172,6 +172,54 @@ export function mockDataShare() {
resolve(paramMock.paramNumberMock);
})
}
},
addTemplate: function (...args) {
console.warn("DataShareHelper.addTemplate 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 (typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
} else {
return new Promise((resolve, reject) => {
resolve(paramMock.paramNumberMock);
})
}
},
delTemplate: function (...args) {
console.warn("DataShareHelper.delTemplate 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 (typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
} else {
return new Promise((resolve, reject) => {
resolve(paramMock.paramNumberMock);
})
}
},
publish: function (...args) {
console.warn("DataShareHelper.publish 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 (typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
} else {
return new Promise((resolve, reject) => {
resolve(paramMock.paramNumberMock);
})
}
},
getPublishedData: function (...args) {
console.warn("DataShareHelper.getPublishedData 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 (typeof args[len - 1] === 'function') {
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
} else {
return new Promise((resolve, reject) => {
resolve(paramMock.paramNumberMock);
})
}
}
}
const dataShareMock = {