mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-21 01:45:24 -04:00
9c1a3fb6b3
Signed-off-by: sunfei <sunfei.sun@huawei.com> Change-Id: I5a1d9297c3236ecdd06304d1efcac2b37647ee14
61 lines
2.8 KiB
JavaScript
61 lines
2.8 KiB
JavaScript
import { paramMock } from "../utils"
|
|
|
|
export function mockUtil() {
|
|
const result = {
|
|
printf: function(...args) {
|
|
console.warn("util.printf interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return paramMock.paramStringMock;
|
|
},
|
|
getErrorString: function(...args) {
|
|
console.warn("util.getErrorString interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return paramMock.paramStringMock;
|
|
},
|
|
callbackWrapper: function(...args) {
|
|
console.warn("util.callbackWrapper interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
},
|
|
promiseWrapper: function(...args) {
|
|
console.warn("util.promiseWrapper interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return paramMock.paramObjectMock;
|
|
},
|
|
TextDecoder: function(...args) {
|
|
console.warn("util.TextDecoder interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return TextDecoderMock;
|
|
},
|
|
TextEncoder: function(...args) {
|
|
console.warn("util.TextEncoder interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return TextEncoderMock;
|
|
}
|
|
}
|
|
const TextDecoderMock = {
|
|
encoding: '[PC preview] unknow encoding',
|
|
fatal: '[PC preview] unknow fatal',
|
|
ignoreBOM: '[PC preview] unknow ignoreBOM',
|
|
decode: function (...args) {
|
|
console.warn("TextDecoder.decode interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return paramMock.paramStringMock;
|
|
},
|
|
}
|
|
const TextEncoderMock = {
|
|
encoding: '[PC preview] unknow encoding',
|
|
encode: function(...args) {
|
|
console.warn("TextEncoder.encode interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
const arr = new Uint8Array()
|
|
return arr;
|
|
},
|
|
encodeInto: function(...args) {
|
|
console.warn("TextEncoder.encodeInto interface mocked in the Previewer. How this interface works on the Previewer" +
|
|
" may be different from that on a real device.")
|
|
return paramMock.paramObjectMock;
|
|
}
|
|
}
|
|
return result;
|
|
}
|