Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
862e63fa
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
862e63fa
编写于
2月 03, 2023
作者:
Z
zhangfuzhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
deleted conver
Signed-off-by:
N
zhangfuzhi
<
zhangfuzhi1@huawei.com
>
上级
7a819ae3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
1 addition
and
1900 deletion
+1
-1900
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
...tic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
+0
-1898
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets
...test/radiostatistic/entry/src/main/ets/test/List.test.ets
+1
-2
未找到文件。
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/ConvertOptionsJsunit.test.ets
已删除
100644 → 0
浏览文件 @
7a819ae3
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, expect, it } from '@ohos/hypium';
import convertxml from '@ohos.convertxml';
export default function convertOptionsJsunit() {
describe('XmlTest_radio_1', function () {
console.log("************* settings Test start*************");
it('Telephony_convertxml_ConvertXML_0100', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title> Happy </title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: true,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0200', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDeclaration: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0300', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDeclaration: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0400', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreAttributes: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0500', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <!--note-->' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreComment: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0600', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <![CDATA[<foo></bar>]]>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreCDATA: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0700', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDoctype: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0800', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreText: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title"},' +
'{"_type":"element",' +
'"_name":"todo"},' +
'{"_type":"element",' +
'"_name":"todo"}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_0900', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "123",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"123":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1000', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <?go there?>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "123",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"there",' +
'"_type":"instruction",' +
'"_name":"go"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1100', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <?go there?>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "123",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"123":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":{"importance":"high",' +
'"logged":"true"},' +
'"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"instruction",' +
'"_name":"go",' +
'"_instruction":"there"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1200', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "123",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"Happy",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"Work",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"Play",' +
'"_type":"text"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1300', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <![CDATA[1 is < 2]]>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "123",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"1 is < 2",' +
'"_type":"cdata"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1400', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"doctype","doctype":"foo"},' +
'{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
console.info("Telephony_convertxml_ConvertXML_1400 result1 :"+result1);
done();
})
it('Telephony_convertxml_ConvertXML_1500', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!--note-->' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "123",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":"note",' +
'"_type":"comment"},' +
'{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1600', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <a><b/></a>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "123",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"a",' +
'"_elements":[{"_type":"element",' +
'"_name":"b"}]},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1700', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "123",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"text",' +
'"_text":"Happy"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Work"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1800', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "123",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":"note",' +
'"_type":"element",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"title",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_1900', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "123"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",' +
'"_text":"Happy"}],' +
'"_type":"element",' +
'"_name":"title"},' +
'{"123":[{"_type":"text",' +
'"_text":"Work"}],' +
'"_type":"element",' +
'"_name":"todo"},' +
'{"123":[{"_type":"text",' +
'"_text":"Play"}],' +
'"_type":"element",' +
'"_name":"todo"}],' +
'"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"}}],' +
'"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}}}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2000', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title> Happy </title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: true,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2100', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDeclaration: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2200', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDeclaration: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2300', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreAttributes: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2400', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <!--note-->' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreComment: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2500', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <![CDATA[<foo></bar>]]>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreCDATA: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2600', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreDoctype: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2700', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreText: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title"},' +
'{"_type":"element",' +
'"_name":"todo"},' +
'{"_type":"element",' +
'"_name":"todo"}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2800', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "456",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"456":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_2900', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <?go there?>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "456",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"456":"there",' +
'"_type":"instruction",' +
'"_name":"go"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3000', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <?go there?>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "456",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"456":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"456":{"importance":"high",' +
'"logged":"true"},' +
'"_type":"element",' +
'"_name":"note",' +
'"_elements":[{"_type":"instruction",' +
'"_name":"go",' +
'"_instruction":"there"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3100', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "456",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"456":"Happy",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"456":"Work",' +
'"_type":"text"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"456":"Play",' +
'"_type":"text"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3200', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <![CDATA[1 is < 2]]>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "456",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"456":"1 is < 2",' +
'"_type":"cdata"},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3300', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!DOCTYPE foo>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "doctype_next",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"doctype","doctype_next":"foo"},' +
'{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3400', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<!--note-->' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "456",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"456":"note",' +
'"_type":"comment"},' +
'{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3500', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <a><b/></a>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "456",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"_type":"element",' +
'"_name":"a",' +
'"_elements":[{"_type":"element",' +
'"_name":"b"}]},' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3600', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "123",
nameKey: "_name",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"element",' +
'"_name":"title",' +
'"_elements":[{"123":"text",' +
'"_text":"Happy"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Work"}]},' +
'{"123":"element",' +
'"_name":"todo",' +
'"_elements":[{"123":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3700', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "123",
elementsKey: "_elements"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"123":"note",' +
'"_type":"element",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[{"123":"title",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"123":"todo",' +
'"_type":"element",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
it('Telephony_convertxml_ConvertXML_3800', 0, async function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "123"
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"123":[{"123":[{"123":[{"_type":"text",' +
'"_text":"Happy"}],' +
'"_type":"element",' +
'"_name":"title"},' +
'{"123":[{"_type":"text",' +
'"_text":"Work"}],' +
'"_type":"element",' +
'"_name":"todo"},' +
'{"123":[{"_type":"text",' +
'"_text":"Play"}],' +
'"_type":"element",' +
'"_name":"todo"}],' +
'"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"}}],' +
'"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}}}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
/**
* @tc.name: Telephony_convertxml_ConvertXML_3900
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
*/
it('Telephony_convertxml_ConvertXML_3900', 0, function (done) {
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <?go there?>' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var conv = new convertxml.ConvertXML();
let options = {
trim: false,
declarationKey: "_declaration",
instructionKey: "_instruction",
attributesKey: "_attributes",
textKey: "_text",
cdataKey: "_cdata",
doctypeKey: "_doctype",
commentKey: "_comment",
parentKey: "_parent",
typeKey: "_type",
nameKey: "_name",
elementsKey: "_elements",
ignoreInstruction: true
};
var result1 = JSON.stringify(conv.convert(xml, options));
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",' +
'"encoding":"utf-8"}},' +
'"_elements":[{"_type":"element",' +
'"_name":"note",' +
'"_attributes":{"importance":"high",' +
'"logged":"true"},' +
'"_elements":[' +
'{"_type":"element",' +
'"_name":"title",' +
'"_elements":[{"_type":"text",' +
'"_text":"Happy"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Work"}]},' +
'{"_type":"element",' +
'"_name":"todo",' +
'"_elements":[{"_type":"text",' +
'"_text":"Play"}]}]}]}';
expect(result1).assertEqual(str1);
expect(JSON.stringify(conv.convertToJSObject(xml, options))).assertEqual(str1);
done();
})
})
}
\ No newline at end of file
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/List.test.ets
浏览文件 @
862e63fa
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import convertOptionsJsunit from './ConvertOptionsJsunit.test';
import radioJsunit from './RadioJsunit.test';
import radioSecondJsunit from './RadioSecondJsunit.test';
import smsUiJsunit from './SmsMmsJsunit.test';
...
...
@@ -23,7 +23,6 @@ import dataJsunit from './DataJsunit.test';
export default function testsuite() {
dataJsunit();
smsUiJsunit();
convertOptionsJsunit();
radioJsunit();
radioSecondJsunit();
callJsunit();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录