Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed May 16, 2023
1 parent 983b0c0 commit c3043de
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/core/test/lib/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const dsnPublic = 'https://abc@sentry.io:1234/subpath/123';
const tunnel = 'https://hello.com/world';
const _metadata = { sdk: { name: 'sentry.javascript.browser', version: '12.31.12' } } as ClientOptions['_metadata'];

const dsnPublicComponents = makeDsn(dsnPublic);
const dsnPublicComponents = makeDsn(dsnPublic)!;

describe('API', () => {
describe('getEnvelopeEndpointWithUrlEncodedAuth', () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/core/test/lib/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ describe('BaseClient', () => {
});

test('allows missing Dsn', () => {
expect.assertions(1);

const options = getDefaultTestClientOptions();
const client = new TestClient(options);

expect(client.getDsn()).toBeUndefined();
expect(client.getTransport()).toBeUndefined();
});

test('throws with invalid Dsn', () => {
expect.assertions(1);

test('allows being passed an invalid Dsn', () => {
const options = getDefaultTestClientOptions({ dsn: 'abc' });
expect(() => new TestClient(options)).toThrow(SentryError);
const client = new TestClient(options);

expect(client.getDsn()).toBeUndefined();
expect(client.getTransport()).toBeUndefined();
});
});

Expand Down
4 changes: 3 additions & 1 deletion packages/node/test/transports/http.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ const defaultOptions = {
textEncoder,
};

// empty function to keep test output clean
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});

describe('makeNewHttpTransport()', () => {
afterEach(() => {
jest.clearAllMocks();
Expand Down Expand Up @@ -403,7 +406,6 @@ describe('makeNewHttpTransport()', () => {
});

it('should warn if an invalid url is passed', async () => {
const consoleWarnSpy = jest.spyOn(console, 'warn');
const transport = makeNodeTransport({ ...defaultOptions, url: 'invalid url' });
await transport.send(EVENT_ENVELOPE);
expect(consoleWarnSpy).toHaveBeenCalledWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Unit | util | createReplayEnvelope', () => {
projectId: '123',
protocol: 'https',
publicKey: 'abc',
});
})!;

it('creates an envelope for a given Replay event', () => {
const envelope = createReplayEnvelope(replayEvent, payloadWithSequence, dsn);
Expand Down

0 comments on commit c3043de

Please sign in to comment.