-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcatcher.release.test.ts
More file actions
27 lines (20 loc) · 924 Bytes
/
catcher.release.test.ts
File metadata and controls
27 lines (20 loc) · 924 Bytes
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
import { describe, expect, it, vi } from "vitest";
import { createCatcher, createTransport, getLastPayload, wait } from "./catcher.helpers";
vi.mock('@hawk.so/core', async (importOriginal) => {
const actual = await importOriginal<typeof import('@hawk.so/core')>();
return { ...actual, StackParser: class { parse = vi.fn().mockResolvedValue([]); } };
});
describe('Catcher', () => {
it('should include release version when configured', async () => {
const { sendSpy, transport } = createTransport();
createCatcher(transport, { release: '1.2.3' }).send(new Error('e'));
await wait();
expect(getLastPayload(sendSpy).release).toBe('1.2.3');
});
it('should omit release when not configured', async () => {
const { sendSpy, transport } = createTransport();
createCatcher(transport).send(new Error('e'));
await wait();
expect(getLastPayload(sendSpy).release).toBeFalsy();
});
});