Skip to content

Commit c3043de

Browse files
committed
fix tests
1 parent 983b0c0 commit c3043de

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

packages/core/test/lib/api.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const dsnPublic = 'https://[email protected]:1234/subpath/123';
99
const tunnel = 'https://hello.com/world';
1010
const _metadata = { sdk: { name: 'sentry.javascript.browser', version: '12.31.12' } } as ClientOptions['_metadata'];
1111

12-
const dsnPublicComponents = makeDsn(dsnPublic);
12+
const dsnPublicComponents = makeDsn(dsnPublic)!;
1313

1414
describe('API', () => {
1515
describe('getEnvelopeEndpointWithUrlEncodedAuth', () => {

packages/core/test/lib/base.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ describe('BaseClient', () => {
7070
});
7171

7272
test('allows missing Dsn', () => {
73-
expect.assertions(1);
74-
7573
const options = getDefaultTestClientOptions();
7674
const client = new TestClient(options);
7775

7876
expect(client.getDsn()).toBeUndefined();
77+
expect(client.getTransport()).toBeUndefined();
7978
});
8079

81-
test('throws with invalid Dsn', () => {
82-
expect.assertions(1);
83-
80+
test('allows being passed an invalid Dsn', () => {
8481
const options = getDefaultTestClientOptions({ dsn: 'abc' });
85-
expect(() => new TestClient(options)).toThrow(SentryError);
82+
const client = new TestClient(options);
83+
84+
expect(client.getDsn()).toBeUndefined();
85+
expect(client.getTransport()).toBeUndefined();
8686
});
8787
});
8888

packages/node/test/transports/http.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ const defaultOptions = {
8383
textEncoder,
8484
};
8585

86+
// empty function to keep test output clean
87+
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
88+
8689
describe('makeNewHttpTransport()', () => {
8790
afterEach(() => {
8891
jest.clearAllMocks();
@@ -403,7 +406,6 @@ describe('makeNewHttpTransport()', () => {
403406
});
404407

405408
it('should warn if an invalid url is passed', async () => {
406-
const consoleWarnSpy = jest.spyOn(console, 'warn');
407409
const transport = makeNodeTransport({ ...defaultOptions, url: 'invalid url' });
408410
await transport.send(EVENT_ENVELOPE);
409411
expect(consoleWarnSpy).toHaveBeenCalledWith(

packages/replay/test/unit/util/createReplayEnvelope.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Unit | util | createReplayEnvelope', () => {
4242
projectId: '123',
4343
protocol: 'https',
4444
publicKey: 'abc',
45-
});
45+
})!;
4646

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

0 commit comments

Comments
 (0)