Skip to content

Instantly share code, notes, and snippets.

@jcailan
Created October 18, 2022 03:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
SAP CAP launchpage with Integration Tests section (diff file)
diff --git a/node_modules/@sap/cds/app/index.html b/node_modules/@sap/cds/app/index.html
index 23acd86..d292cc9 100644
--- a/node_modules/@sap/cds/app/index.html
+++ b/node_modules/@sap/cds/app/index.html
@@ -68,6 +68,11 @@
{{apps}}
</ul>
+ <h2> Integration Tests: </h2>
+ <ul>
+ {{tests}}
+ </ul>
+
<h2> Service Endpoints: </h2>
{{services}}
diff --git a/node_modules/@sap/cds/app/index.js b/node_modules/@sap/cds/app/index.js
index c52f6a4..5697a48 100644
--- a/node_modules/@sap/cds/app/index.js
+++ b/node_modules/@sap/cds/app/index.js
@@ -14,6 +14,10 @@ module.exports = { get html(){
html => `\n<li><a href="${html}">/${html.replace(/^[/]/,'')}</a></li>`
).join('\n') || '— none —'
)
+ .replace ('{{tests}}', _test_links().map(
+ html => `\n<li><a href="${html}">/${html.replace(/^[/]/,'')}</a></li>`
+ ).join('\n') || '— none —'
+ )
.replace ('{{services}}', cds.service.providers.map (srv => `
<h3>
<a href="${srv.path}">${srv.path}</a>${metadata(srv)} ${_moreLinks(srv)}
@@ -50,6 +54,14 @@ function _app_links() {
return files.concat (cds.app._app_links || [])
}
+function _test_links() {
+ const folder = path.resolve (cds.root, cds.env.folders.app)
+ const files = find (folder, ['*/*/test/*/*.html']).map (
+ file => path.relative(folder,file).replace (/\\/g,'/')
+ )
+ return files.concat (cds.app._test_links || [])
+}
+
function _entities_in (service) {
const exposed=[], {entities} = service
for (let each in entities) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment