Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cloudflare): Add withSentry method #13025

Merged
merged 5 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: Update init tests
  • Loading branch information
AbhiPrasad committed Jul 29, 2024
commit e02e283681c71979cedd007c7ab1fb2814acb50c
8 changes: 6 additions & 2 deletions packages/cloudflare/test/sdk.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { describe, expect, test, vi } from 'vitest';

import * as SentryCore from '@sentry/core';
import { CloudflareClient } from '../src/client';
import { init } from '../src/sdk';

describe('init', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: could we add a test for init returning a client?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed with 87b4fa1

test('should call initAndBind with the correct options', () => {
const initAndBindSpy = vi.spyOn(SentryCore, 'initAndBind');
init({});
const client = init({});

expect(initAndBindSpy).toHaveBeenCalledWith(expect.any(Function), expect.any(Object));
expect(initAndBindSpy).toHaveBeenCalledWith(CloudflareClient, expect.any(Object));

expect(client).toBeDefined();
expect(client).toBeInstanceOf(CloudflareClient);
});
});
Loading