Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Jan 22, 2025
1 parent 5172108 commit dc47eb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/carrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type VersionedCarrier = {
/**
* IMPORTANT - This must be updated if any breaking changes are made to the 'SentryCarrier' interface.
*/
const CARRIER_VERSION = '9';
export const CARRIER_VERSION = '9';

export interface SentryCarrier {
acs?: AsyncContextStrategy;
Expand Down
17 changes: 9 additions & 8 deletions packages/core/test/lib/carrier.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getSentryCarrier } from '../../src/carrier';
import { SDK_VERSION } from '../../src/utils-hoist/version';
import { CARRIER_VERSION } from '../../src/carrier';

describe('getSentryCarrier', () => {
describe('base case (one SDK)', () => {
Expand All @@ -11,17 +11,17 @@ describe('getSentryCarrier', () => {

expect(globalObject).toEqual({
__SENTRY__: {
version: SDK_VERSION,
[SDK_VERSION]: {},
version: CARRIER_VERSION,
[CARRIER_VERSION]: {},
},
});
});

it('returns the existing sentry carrier object if it already exists', () => {
const originalGlobalObject = {
__SENTRY__: {
version: SDK_VERSION,
[SDK_VERSION]: {
version: CARRIER_VERSION,
[CARRIER_VERSION]: {
acs: {},
},
},
Expand All @@ -42,13 +42,14 @@ describe('getSentryCarrier', () => {
describe('multiple (older) SDKs', () => {
it("returns the version of the sentry carrier object of the SDK's version rather than the one set in .version", () => {
const sentryCarrier = getSentryCarrier({
// @ts-expect-error - this is just a test object
__SENTRY__: {
version: '8.0.0', // another SDK set this
'8.0.0': {
// @ts-expect-error - this is just a test object
stack: {},
},
[SDK_VERSION]: {
[CARRIER_VERSION]: {
// @ts-expect-error - this is just a test object
acs: {},
},
hub: {},
Expand Down Expand Up @@ -82,7 +83,7 @@ describe('getSentryCarrier', () => {
'8.0.0': {
acs: {},
},
[SDK_VERSION]: {},
[CARRIER_VERSION]: {},
},
});
});
Expand Down

0 comments on commit dc47eb9

Please sign in to comment.