Files
AndreaSlopFotografie/web/src/monitoring/config.test.ts
T
SluijsensandClaude Opus 5.5 6d3a1566c2
Continuous Integration / lighthouse (pull_request) Canceled after 0s
Continuous Integration / deploy-test (pull_request) Canceled after 0s
Continuous Integration / deploy-production (pull_request) Canceled after 0s
Continuous Integration / check (pull_request) Canceled after 2m22s
Adds Sentry and Umami monitoring to the site
Sentry loads after the page and reports errors only, without personal data;
Umami counts visits per environment. Both only run on andreaslop.nl and
test.andreaslop.nl. The CSP allows just these two hosts, and builds carry the
commit SHA as release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:08:47 +02:00

57 lines
1.5 KiB
TypeScript

import fc from 'fast-check';
import { describe, expect, it } from 'vitest';
import {
monitoredHostnames,
monitoringFor,
sentryIngestOrigin,
} from './config';
// Alles wat geen test- of productiehost is
const otherHostname = fc
.oneof(
fc.domain(),
fc.ipV4(),
fc.ipV6(),
fc.string(),
fc.constantFrom(
'localhost',
'127.0.0.1',
'www.andreaslop.nl',
'andreaslop.nl.',
'test.andreaslop.nl.evil.com',
'__proto__',
'constructor',
),
)
.filter((host) => !monitoredHostnames.includes(host));
describe('monitoringFor', () => {
it('productiehost meet als production met de productiewebsite', () => {
expect(monitoringFor('andreaslop.nl')).toEqual({
environment: 'production',
umamiWebsiteId: '3edbb7d1-4388-4f2d-9cef-11ade88ace96',
});
});
it('testhost meet als test met de testwebsite', () => {
expect(monitoringFor('test.andreaslop.nl')).toEqual({
environment: 'test',
umamiWebsiteId: '7fb301ab-6ecc-4aea-beee-71bcb6009bfe',
});
});
it('elke andere host meet niets (M1)', () => {
fc.assert(
fc.property(otherHostname, (host) => {
expect(monitoringFor(host)).toBeNull();
}),
);
});
});
it('Sentry-ingest is de EU-host uit de DSN, zonder sleutel', () => {
expect(sentryIngestOrigin).toBe(
'https://o4511795618185216.ingest.de.sentry.io',
);
});