Skip to content

Commit b884d7d

Browse files
committed
Checks for v3 application & library types
1 parent a49ed9b commit b884d7d

File tree

1 file changed

+121
-95
lines changed
  • test/lib/validation/schema/specVersion/kind

1 file changed

+121
-95
lines changed

test/lib/validation/schema/specVersion/kind/project.js

Lines changed: 121 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -197,108 +197,134 @@ test("No specVersion", async (t) => {
197197
});
198198

199199
["3.0"].forEach(function(specVersion) {
200-
test(`application (specVersion ${specVersion}): builder/bundles/bundleOptions deprectaions`, async (t) => {
201-
await assertValidation(t, {
202-
"specVersion": specVersion,
203-
"kind": "project",
204-
"type": "application",
205-
"metadata": {
206-
"name": "com.sap.ui5.test",
207-
"copyright": "yes"
208-
},
209-
"builder": {
210-
"bundles": [{
211-
"bundleOptions": {
212-
"debugMode": true
213-
}
214-
}]
215-
}
216-
}, [
217-
{
218-
keyword: "additionalProperties",
219-
dataPath: "/builder/bundles/0/bundleOptions",
220-
params: {
221-
additionalProperty: "debugMode",
200+
["application", "library"].forEach(function(type) {
201+
test(`${type} (specVersion ${specVersion}): builder/bundles/bundleOptions`, async (t) => {
202+
await assertValidation(t, {
203+
"specVersion": specVersion,
204+
"kind": "project",
205+
"type": type,
206+
"metadata": {
207+
"name": "com.sap.ui5.test",
208+
"copyright": "yes"
222209
},
223-
message: "should NOT have additional properties",
224-
},
225-
]);
226-
});
210+
"builder": {
211+
"bundles": [{
212+
"bundleOptions": {
213+
"optimize": false,
214+
"decorateBootstrapModule": false,
215+
"addTryCatchRestartWrapper": true,
216+
"usePredefineCalls": true,
217+
"numberOfParts": 8,
218+
"sourceMap": false
219+
}
220+
}]
221+
}
222+
});
223+
});
227224

228-
test(`Invalid (specVersion ${specVersion}): builder/bundles/bundleOptions config`, async (t) => {
229-
await assertValidation(t, {
230-
"specVersion": specVersion,
231-
"kind": "project",
232-
"type": "application",
233-
"metadata": {
234-
"name": "com.sap.ui5.test",
235-
"copyright": "yes"
236-
},
237-
"builder": {
238-
"bundles": [{
239-
"bundleOptions": {
240-
"optimize": "invalid value",
241-
"decorateBootstrapModule": {"invalid": "value"},
242-
"addTryCatchRestartWrapper": ["invalid value"],
243-
"usePredefineCalls": 12,
244-
"numberOfParts": true,
245-
"sourceMap": 55
246-
}
247-
}]
248-
}
249-
}, [
250-
{
251-
keyword: "type",
252-
dataPath: "/builder/bundles/0/bundleOptions/optimize",
253-
params: {
254-
type: "boolean",
225+
test(`${type} (specVersion ${specVersion}): builder/bundles/bundleOptions deprectaions`, async (t) => {
226+
await assertValidation(t, {
227+
"specVersion": specVersion,
228+
"kind": "project",
229+
"type": type,
230+
"metadata": {
231+
"name": "com.sap.ui5.test",
232+
"copyright": "yes"
255233
},
256-
message: "should be boolean"
257-
},
258-
{
259-
keyword: "type",
260-
dataPath:
261-
"/builder/bundles/0/bundleOptions/decorateBootstrapModule",
262-
params: {
263-
type: "boolean",
234+
"builder": {
235+
"bundles": [{
236+
"bundleOptions": {
237+
"debugMode": true
238+
}
239+
}]
240+
}
241+
}, [
242+
{
243+
keyword: "additionalProperties",
244+
dataPath: "/builder/bundles/0/bundleOptions",
245+
params: {
246+
additionalProperty: "debugMode",
247+
},
248+
message: "should NOT have additional properties",
264249
},
265-
message: "should be boolean"
266-
},
267-
{
268-
keyword: "type",
269-
dataPath:
270-
"/builder/bundles/0/bundleOptions/addTryCatchRestartWrapper",
271-
params: {
272-
type: "boolean",
250+
]);
251+
});
252+
253+
test(`${type} invalid (specVersion ${specVersion}): builder/bundles/bundleOptions config`, async (t) => {
254+
await assertValidation(t, {
255+
"specVersion": specVersion,
256+
"kind": "project",
257+
"type": type,
258+
"metadata": {
259+
"name": "com.sap.ui5.test",
260+
"copyright": "yes"
273261
},
274-
message: "should be boolean"
275-
},
276-
{
277-
keyword: "type",
278-
dataPath:
279-
"/builder/bundles/0/bundleOptions/usePredefineCalls",
280-
params: {
281-
type: "boolean",
262+
"builder": {
263+
"bundles": [{
264+
"bundleOptions": {
265+
"optimize": "invalid value",
266+
"decorateBootstrapModule": {"invalid": "value"},
267+
"addTryCatchRestartWrapper": ["invalid value"],
268+
"usePredefineCalls": 12,
269+
"numberOfParts": true,
270+
"sourceMap": 55
271+
}
272+
}]
273+
}
274+
}, [
275+
{
276+
keyword: "type",
277+
dataPath: "/builder/bundles/0/bundleOptions/optimize",
278+
params: {
279+
type: "boolean",
280+
},
281+
message: "should be boolean"
282282
},
283-
message: "should be boolean"
284-
},
285-
{
286-
keyword: "type",
287-
dataPath:
288-
"/builder/bundles/0/bundleOptions/numberOfParts",
289-
params: {
290-
type: "number",
283+
{
284+
keyword: "type",
285+
dataPath:
286+
"/builder/bundles/0/bundleOptions/decorateBootstrapModule",
287+
params: {
288+
type: "boolean",
289+
},
290+
message: "should be boolean"
291291
},
292-
message: "should be number"
293-
},
294-
{
295-
keyword: "type",
296-
dataPath: "/builder/bundles/0/bundleOptions/sourceMap",
297-
params: {
298-
type: "boolean",
292+
{
293+
keyword: "type",
294+
dataPath:
295+
"/builder/bundles/0/bundleOptions/addTryCatchRestartWrapper",
296+
params: {
297+
type: "boolean",
298+
},
299+
message: "should be boolean"
299300
},
300-
message: "should be boolean"
301-
}
302-
]);
301+
{
302+
keyword: "type",
303+
dataPath:
304+
"/builder/bundles/0/bundleOptions/usePredefineCalls",
305+
params: {
306+
type: "boolean",
307+
},
308+
message: "should be boolean"
309+
},
310+
{
311+
keyword: "type",
312+
dataPath:
313+
"/builder/bundles/0/bundleOptions/numberOfParts",
314+
params: {
315+
type: "number",
316+
},
317+
message: "should be number"
318+
},
319+
{
320+
keyword: "type",
321+
dataPath: "/builder/bundles/0/bundleOptions/sourceMap",
322+
params: {
323+
type: "boolean",
324+
},
325+
message: "should be boolean"
326+
}
327+
]);
328+
});
303329
});
304330
});

0 commit comments

Comments
 (0)