This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch new-site-dev in repository https://gitbox.apache.org/repos/asf/pinot-site.git
commit 6d8864d81667f2168e2fffdcccfe03f54ae0b965 Author: Xiang Fu <[email protected]> AuthorDate: Fri Jan 2 06:10:28 2026 -0800 Add Matomo smoke test --- package.json | 2 +- tests/matomo.test.cjs | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 71955cc0..603119e0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "check": "npx prettier --check .", "format": "npx prettier --write .", "postinstall": "husky install", - "test": "echo \"Error: No test set up\"" + "test": "node --test tests/matomo.test.cjs" }, "dependencies": { "@next/bundle-analyzer": "14.0.3", diff --git a/tests/matomo.test.cjs b/tests/matomo.test.cjs new file mode 100644 index 00000000..22b38c84 --- /dev/null +++ b/tests/matomo.test.cjs @@ -0,0 +1,29 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); + +const repoRoot = path.resolve(__dirname, '..'); +const layoutPath = path.join(repoRoot, 'app', 'layout.tsx'); +const nextConfigPath = path.join(repoRoot, 'next.config.js'); + +test('matomo tracking snippet is present in the layout', () => { + const layoutContents = fs.readFileSync(layoutPath, 'utf8'); + + assert.ok( + layoutContents.includes('https://analytics.apache.org/'), + 'Expected analytics.apache.org base URL in layout' + ); + assert.ok(layoutContents.includes("matomo.php"), 'Expected matomo.php in layout'); + assert.ok(layoutContents.includes("matomo.js"), 'Expected matomo.js in layout'); + assert.ok(layoutContents.includes("setSiteId', '88'"), 'Expected Matomo site ID 88 in layout'); +}); + +test('csp allows analytics.apache.org in script-src', () => { + const nextConfigContents = fs.readFileSync(nextConfigPath, 'utf8'); + + assert.ok( + nextConfigContents.includes('analytics.apache.org'), + 'Expected analytics.apache.org in next.config.js CSP' + ); +}); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
