Skip to content

Commit

Permalink
add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelbeltran committed Nov 19, 2024
1 parent c33e9c5 commit 4c701ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sdk/__tests__/RaygunClient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { RaygunClientOptions } from '../src/Types';
describe('RaygunClient', () => {
beforeAll(() => {
const options: RaygunClientOptions = {
apiKey: '',// Your API key
version: '', // Your application version
apiKey: 'ABCD',
version: '1.2.3',
logLevel: 'off',
enableCrashReporting: true,
enableRealUserMonitoring: false,
Expand All @@ -32,9 +32,15 @@ describe('RaygunClient', () => {
// fetch should be called once
expect(fetch).toHaveBeenCalledTimes(1);

// Check url correct
expect(fetch.mock.calls[0][0]).toBe('https://api.raygun.com/entries?apiKey=ABCD');

// Capture body from fetch and check if correct
const body = JSON.parse(fetch.mock.calls[0][1].body);
expect(body.Details.Error.Message).toBe('Test error');

// Check if the version is correct
expect(body.Details.Version).toBe('1.2.3');
});

it('should fail to send error', async () => {
Expand Down

0 comments on commit 4c701ea

Please sign in to comment.