Skip to content

Commit e1921a1

Browse files
gtamanahaalexs-mparticle
authored andcommitted
fix(tests): Update reportingLogger tests to use globalThis instead of window for location and ROKT_DOMAIN
1 parent 9f7beb8 commit e1921a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/jest/reportingLogger.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ describe('ReportingLogger', () => {
1111
apiClient = { sendLogToServer: jest.fn() };
1212

1313
// Mock location object to allow modifying search property
14-
delete (window as any).location;
15-
(window as any).location = {
14+
delete (globalThis as any).location;
15+
(globalThis as any).location = {
1616
href: 'https://e.com',
1717
search: ''
1818
};
1919

20-
Object.assign(window, {
20+
Object.assign(globalThis, {
2121
navigator: { userAgent: 'ua' },
2222
mParticle: { config: { isWebSdkLoggingEnabled: true } },
2323
ROKT_DOMAIN: 'set'
@@ -48,7 +48,7 @@ describe('ReportingLogger', () => {
4848
});
4949

5050
it('does not log if ROKT_DOMAIN missing', () => {
51-
delete (window as any).ROKT_DOMAIN;
51+
delete (globalThis as any).ROKT_DOMAIN;
5252
logger = new ReportingLogger(apiClient, sdkVersion);
5353
logger.error('x');
5454
expect(apiClient.sendLogToServer).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)