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', ); });