Skip to content

Commit

Permalink
test: Add tests for custom UI5 config path
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Sep 20, 2024
1 parent 2ab3779 commit ad9f1ec
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 455 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ framework:
- name: sap.m
- name: sap.ui.core
- name: sap.landvisz
resources:
configuration:
paths:
webapp: webapp2
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"_version": "1.12.0",

"sap.app": {
"id": "com.ui5.troublesome.app",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"v4": {
"uri": "/api/odata-4/",
"type": "OData",
"settings": {
"odataVersion": "4.0"
}
}
}
},

"sap.ui": {
"technology": "UI5",
"icons": {},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},

"sap.ui5": {
"rootView": {
"viewName": "com.ui5.troublesome.app.view.App",
"type": "XML",
"async": true,
"id": "app"
},

"dependencies": {
"minUI5Version": "1.119.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.commons": {}
}
},

"handleValidation": true,

"contentDensities": {
"compact": true,
"cozy": true
},

"resources": {
"js": [{ "uri": "path/to/thirdparty.js" }]
},

"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "com.ui5.troublesome.app.i18n.i18n"
}
},
"odata-v4": {
"type": "sap.ui.model.odata.v4.ODataModel",
"settings": {
"synchronizationMode": "None"
}
},
"odata-v4-via-dataSource": {
"dataSource": "v4",
"settings": {
"synchronizationMode": "None"
}
},
"odata": {
"type": "sap.ui.model.odata.ODataModel",
"settings": {
"serviceUrl": "/api/odata"
}
}
},

"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "com.ui5.troublesome.app.view",
"controlId": "app",
"controlAggregation": "pages",
"async": true
},
"routes": [
{
"pattern": "",
"name": "main",
"target": "main"
}
],
"targets": {
"main": {
"viewId": "main",
"viewName": "Main"
}
}
}
}
}
16 changes: 15 additions & 1 deletion test/lib/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ test.serial("lint: All files of com.ui5.troublesome.app with custom config", asy
t.snapshot(preprocessLintResultsForSnapshot(res));
});

test.serial("lint: All files of com.ui5.troublesome.app with custom UI5 config", async (t) => {
test.serial("lint: com.ui5.troublesome.app with custom UI5 config", async (t) => {
const projectPath = path.join(fixturesProjectsPath, "com.ui5.troublesome.app");
const {lintProject} = t.context;

Expand All @@ -157,3 +157,17 @@ test.serial("lint: All files of com.ui5.troublesome.app with custom UI5 config",

t.snapshot(preprocessLintResultsForSnapshot(res));
});

test.only("lint: com.ui5.troublesome.app with custom UI5 config which does NOT exist", async (t) => {
const projectPath = path.join(fixturesProjectsPath, "com.ui5.troublesome.app");
const {lintProject} = t.context;
const ui5ConfigPath = "./configs/ui5-DOES-NOT-EXIST.yaml";

await t.throwsAsync(lintProject({
rootDir: projectPath,
pathsToLint: [],
reportCoverage: true,
includeMessageDetails: true,
ui5ConfigPath,
}), {message: `Unable to find UI5 config file '${ui5ConfigPath}'`});
});
Loading

0 comments on commit ad9f1ec

Please sign in to comment.