Files
e-tib.com/tests/create-services.test.ts

27 lines
930 B
TypeScript

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { getAppServices } from '../lib/services/create-services';
import { GlitchtipErrorReportingService } from '../lib/services/errors/glitchtip-error-reporting-service';
// Mock config to ensure sentry is enabled
vi.mock('../lib/config', () => ({
config: {
analytics: { umami: { enabled: false } },
errors: { glitchtip: { enabled: true, dsn: 'https://test@glitchtip.infra.mintel.me/5' } },
logging: { level: 'info' },
notifications: { gotify: { enabled: false } },
},
getMaskedConfig: () => ({}),
}));
describe('AppServices (Client)', () => {
beforeEach(() => {
// Reset singleton
globalThis.__appServices = undefined;
});
it('should instantiate GlitchtipErrorReportingService when enabled', () => {
const services = getAppServices();
expect(services.errors).toBeInstanceOf(GlitchtipErrorReportingService);
});
});