-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathmetrics.spec.tsx
More file actions
34 lines (29 loc) · 1.11 KB
/
metrics.spec.tsx
File metadata and controls
34 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Only import and test functions that don't have circular dependencies
const {dotnetMetrics} = jest.requireActual('sentry/gettingStartedDocs/dotnet/metrics');
describe('metrics', () => {
const mockParams = {
dsn: {
public: 'https://test@example.com/123',
},
sourcePackageRegistries: {
isLoading: false,
},
};
it('generates metrics onboarding config with default parameters', () => {
const result = dotnetMetrics();
// Test install step
const installSteps = result.install(mockParams);
expect(installSteps).toHaveLength(1);
expect(installSteps[0].type).toBe('install');
expect(installSteps[0].content).toHaveLength(2);
// Test verify step
const verifySteps = result.verify(mockParams);
expect(verifySteps).toHaveLength(1);
expect(verifySteps[0].type).toBe('verify');
expect(verifySteps[0].content).toHaveLength(3);
const codeSnippet = verifySteps[0].content[1].code;
expect(codeSnippet).toContain('SentrySdk.Init');
expect(codeSnippet).toContain(mockParams.dsn.public);
expect(codeSnippet).toContain('Metrics.EmitCounter');
});
});