From 346d5c58a34516f67afbe3559c502c2eae75566e Mon Sep 17 00:00:00 2001 From: scw Date: Fri, 7 Jan 2022 09:36:17 +0800 Subject: [PATCH] fix convertxml Mock Signed-off-by: scw --- .../extend/systemplugin/napi/convertxml.js | 19 +++++++++++++++++++ .../main/extend/systemplugin/napi/index.js | 3 +++ runtime/main/extend/systemplugin/napi/xml.js | 16 ++-------------- 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 runtime/main/extend/systemplugin/napi/convertxml.js diff --git a/runtime/main/extend/systemplugin/napi/convertxml.js b/runtime/main/extend/systemplugin/napi/convertxml.js new file mode 100644 index 00000000..217f231a --- /dev/null +++ b/runtime/main/extend/systemplugin/napi/convertxml.js @@ -0,0 +1,19 @@ +import { paramMock } from "../utils" + +export function mockConvertXml() { + const result = { + ConvertXML: function(...args) { + console.warn("convertXml.ConvertXML interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + return ConvertXMLMock; + } + } + const ConvertXMLMock = { + convert: function(...args) { + console.warn("ConvertXML.convert 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; +} diff --git a/runtime/main/extend/systemplugin/napi/index.js b/runtime/main/extend/systemplugin/napi/index.js index a410417d..29e3cde9 100644 --- a/runtime/main/extend/systemplugin/napi/index.js +++ b/runtime/main/extend/systemplugin/napi/index.js @@ -37,6 +37,7 @@ import { mockBundle } from './bundle' import { mockInnerBundle } from './innerBundleManager' import { mockUri } from './uri' import { mockXml } from './xml' +import { mockConvertXml } from './convertxml' import { mockStatfs } from './statfs' import { mockSettings } from './settings' @@ -121,6 +122,8 @@ export function mockRequireNapiFun() { return mockUri(); case "xml": return mockXml(); + case "convertxml": + return mockConvertXml(); case "statfs": return mockStatfs(); case "settings": diff --git a/runtime/main/extend/systemplugin/napi/xml.js b/runtime/main/extend/systemplugin/napi/xml.js index 74ebc513..c24ce281 100644 --- a/runtime/main/extend/systemplugin/napi/xml.js +++ b/runtime/main/extend/systemplugin/napi/xml.js @@ -11,11 +11,6 @@ export function mockXml() { console.warn("xml.XmlPullParser interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") return XmlPullParserMock; - }, - ConvertXML: function(...args) { - console.warn("xml.ConvertXML interface mocked in the Previewer. How this interface works on the Previewer" + - " may be different from that on a real device.") - return ConvertXMLMock; } } const XmlSerializerMock = { @@ -58,20 +53,13 @@ export function mockXml() { setDocType: function(...args) { console.warn("XmlSerializer.setDocType interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - }, + } } const XmlPullParserMock = { parse: function(...args) { console.warn("XmlPullParser.parse interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.") - }, - } - const ConvertXMLMock = { - convert: function(...args) { - console.warn("ConvertXML.convert 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; }