add mock of distributedData

Signed-off-by: dboy190 <dulei1@huawei.com>
This commit is contained in:
dboy190 2022-08-08 13:44:41 +08:00
parent 9934af24a1
commit 89f71f1ead

View File

@ -465,6 +465,45 @@ export function mockDistributedData() {
resolve()
})
}
};
this.backup = function (...args) {
console.warn("KVStore.backup 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)
} else {
return new Promise((resolve) => {
resolve()
})
}
};
this.restore = function (...args) {
console.warn("KVStore.restore 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)
} else {
return new Promise((resolve) => {
resolve()
})
}
};
this.deleteBackup = function (...args) {
console.warn("KVStore.deleteBackup 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)
} else {
return new Promise((resolve) => {
resolve()
})
}
};
}
};