Skip to content

Commit 74ac581

Browse files
committed
[INTERNAL] Further enhance tests
1 parent 366f330 commit 74ac581

File tree

1 file changed

+223
-0
lines changed

1 file changed

+223
-0
lines changed

test/lib/processors/jsdoc/lib/transformApiJson.js

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,97 @@ test("Test with docuindex.json reference", async (t) => {
986986
"since": "2.0.0"
987987
}
988988
},
989+
{
990+
"kind": "class",
991+
"name": "sap.ui5.tooling.test.TestControl",
992+
"basename": "TestControl",
993+
"resource": "sap/ui5/tooling/test/TestControl.js",
994+
"module": "sap/ui5/tooling/test/TestControl",
995+
"export": "",
996+
"static": true,
997+
"visibility": "public",
998+
"extends": "sap.ui.core.Control",
999+
"description": "This control is just for UI5 Tooling testing purposes.",
1000+
"ui5-metadata": {
1001+
"stereotype": "control"
1002+
},
1003+
"constructor": {
1004+
"visibility": "public",
1005+
"parameters": [
1006+
{
1007+
"name": "sId",
1008+
"type": "string",
1009+
"optional": true,
1010+
"description": "TEST DESCRIPTION",
1011+
},
1012+
{
1013+
"name": "mSettings",
1014+
"type": "object",
1015+
"optional": true,
1016+
"description": "TEST DESCRIPTION",
1017+
}
1018+
],
1019+
"description": "TEST DESCRIPTION",
1020+
},
1021+
"methods": [
1022+
{
1023+
"name": "extend",
1024+
"visibility": "public",
1025+
"static": true,
1026+
"returnValue": {
1027+
"type": "function",
1028+
"description": "TEST DESCRIPTION",
1029+
},
1030+
"parameters": [
1031+
{
1032+
"name": "sClassName",
1033+
"type": "string",
1034+
"optional": false,
1035+
"description": "TEST DESCRIPTION",
1036+
},
1037+
{
1038+
"name": "oClassInfo",
1039+
"type": "object",
1040+
"optional": true,
1041+
"description": "TEST DESCRIPTION",
1042+
},
1043+
{
1044+
"name": "FNMetaImpl",
1045+
"type": "function",
1046+
"optional": true,
1047+
"description": "TEST DESCRIPTION",
1048+
}
1049+
],
1050+
"description": "TEST DESCRIPTION",
1051+
},
1052+
{
1053+
"name": "getMetadata",
1054+
"visibility": "public",
1055+
"static": true,
1056+
"returnValue": {
1057+
"type": "sap.ui.core.ElementMetadata",
1058+
"description": "TEST DESCRIPTION",
1059+
},
1060+
"description": "TEST DESCRIPTION",
1061+
}
1062+
]
1063+
},
9891064
]
9901065
}
9911066
));
9921067

1068+
readFile.withArgs("/test-resources/sap/ui5/tooling/test/demokit/docuindex.json").yieldsAsync(null, JSON.stringify(
1069+
{
1070+
"explored": {
1071+
"entities": [
1072+
// {
1073+
// "id": "sap.ui5.tooling.test.TestControl"
1074+
// }
1075+
]
1076+
}
1077+
}
1078+
));
1079+
9931080
const readdir = sinon.stub().yieldsAsync(new Error("Not found!"));
9941081

9951082
const fs = {readFile, readdir};
@@ -1001,6 +1088,7 @@ test("Test with docuindex.json reference", async (t) => {
10011088
}
10021089
);
10031090

1091+
/* eslint-disable max-len */
10041092
t.deepEqual(JSON.parse(apiJsonContent), {
10051093
"$schema-ref": "http://schemas.sap.com/sapui5/designtime/api.json/1.0",
10061094
"version": "2.1.0",
@@ -1014,6 +1102,13 @@ test("Test with docuindex.json reference", async (t) => {
10141102
export: "",
10151103
kind: "namespace",
10161104
module: "sap/ui5/tooling/test/library",
1105+
nodes: [
1106+
{
1107+
"name": "sap.ui5.tooling.test.TestControl",
1108+
"description": "<p>This control is just for UI5 Tooling testing purposes.</p>",
1109+
"href": "api/sap.ui5.tooling.test.TestControl",
1110+
}
1111+
],
10171112
name: "sap.ui5.tooling.test",
10181113
resource: "sap/ui5/tooling/test/library.js",
10191114
since: "1.0.0",
@@ -1022,6 +1117,133 @@ test("Test with docuindex.json reference", async (t) => {
10221117
title: "namespace sap.ui5.tooling.test",
10231118
visibility: "public",
10241119
},
1120+
{
1121+
"kind": "class",
1122+
"name": "sap.ui5.tooling.test.TestControl",
1123+
"basename": "TestControl",
1124+
"resource": "sap/ui5/tooling/test/TestControl.js",
1125+
"module": "sap/ui5/tooling/test/TestControl",
1126+
"export": "",
1127+
"static": true,
1128+
"visibility": "public",
1129+
"extends": "sap.ui.core.Control",
1130+
"description": "<p>This control is just for UI5 Tooling testing purposes.</p>",
1131+
"ui5-metadata": {
1132+
"stereotype": "control"
1133+
},
1134+
"constructor": {
1135+
"visibility": "public",
1136+
"parameters": [
1137+
{
1138+
"name": "sId",
1139+
"optional": true,
1140+
"description": "<p>TEST DESCRIPTION</p>",
1141+
"phoneName": "sId",
1142+
"depth": 0,
1143+
"types": [
1144+
{
1145+
"name": "string",
1146+
"linkEnabled": false
1147+
}
1148+
],
1149+
"defaultValue": ""
1150+
},
1151+
{
1152+
"name": "mSettings",
1153+
"optional": true,
1154+
"description": "<p>TEST DESCRIPTION</p>",
1155+
"phoneName": "mSettings",
1156+
"depth": 0,
1157+
"types": [
1158+
{
1159+
"name": "object",
1160+
"linkEnabled": false
1161+
}
1162+
],
1163+
"defaultValue": ""
1164+
}
1165+
],
1166+
"description": "<p>TEST DESCRIPTION</p>",
1167+
"references": [],
1168+
"codeExample": "<pre>new sap.ui5.tooling.test.TestControl(sId?, mSettings?)</pre>"
1169+
},
1170+
"methods": [
1171+
{
1172+
"name": "sap.ui5.tooling.test.TestControl.extend",
1173+
"visibility": "public",
1174+
"static": true,
1175+
"returnValue": {
1176+
"type": "function",
1177+
"description": "<p>TEST DESCRIPTION</p>",
1178+
"types": [
1179+
{
1180+
"value": "function"
1181+
}
1182+
]
1183+
},
1184+
"parameters": [
1185+
{
1186+
"name": "sClassName",
1187+
"optional": false,
1188+
"description": "<p>TEST DESCRIPTION</p>",
1189+
"types": [
1190+
{
1191+
"value": "string"
1192+
}
1193+
],
1194+
"defaultValue": ""
1195+
},
1196+
{
1197+
"name": "oClassInfo",
1198+
"optional": true,
1199+
"description": "<p>TEST DESCRIPTION</p>",
1200+
"types": [
1201+
{
1202+
"value": "object"
1203+
}
1204+
],
1205+
"defaultValue": ""
1206+
},
1207+
{
1208+
"name": "FNMetaImpl",
1209+
"optional": true,
1210+
"description": "<p>TEST DESCRIPTION</p>",
1211+
"types": [
1212+
{
1213+
"value": "function"
1214+
}
1215+
],
1216+
"defaultValue": ""
1217+
}
1218+
],
1219+
"description": "<p>TEST DESCRIPTION</p>",
1220+
"href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.extend",
1221+
"code": "<pre>sap.ui5.tooling.test.TestControl.extend(sClassName, oClassInfo?, FNMetaImpl?) : function</pre>"
1222+
},
1223+
{
1224+
"name": "sap.ui5.tooling.test.TestControl.getMetadata",
1225+
"visibility": "public",
1226+
"static": true,
1227+
"returnValue": {
1228+
"type": "sap.ui.core.ElementMetadata",
1229+
"description": "<p>TEST DESCRIPTION</p>",
1230+
"types": [
1231+
{
1232+
"value": "sap.ui.core.ElementMetadata",
1233+
"href": "api/sap.ui.core.ElementMetadata",
1234+
"linkEnabled": true
1235+
}
1236+
]
1237+
},
1238+
"description": "<p>TEST DESCRIPTION</p>",
1239+
"href": "api/sap.ui5.tooling.test.TestControl#methods/sap.ui5.tooling.test.TestControl.getMetadata",
1240+
"code": "<pre>sap.ui5.tooling.test.TestControl.getMetadata() : sap.ui.core.ElementMetadata</pre>"
1241+
}
1242+
],
1243+
"displayName": "sap.ui5.tooling.test.TestControl",
1244+
"title": "class sap.ui5.tooling.test.TestControl",
1245+
"subTitle": "",
1246+
},
10251247
{
10261248
displayName: "sap",
10271249
kind: "namespace",
@@ -1067,4 +1289,5 @@ test("Test with docuindex.json reference", async (t) => {
10671289
},
10681290
]
10691291
});
1292+
/* eslint-enable max-len */
10701293
});

0 commit comments

Comments
 (0)