Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 060f790

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: refactoring
1 parent 7f8df3b commit 060f790

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/utils/__tests__/utils.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as utils from '@site/src/utils';
2-
import { LOCALHOST_APP_ID, DEFAULT_WS_SERVER } from '../constants';
2+
import { LOCALHOST_APP_ID, DEFAULT_WS_SERVER, VERCEL_DEPLOYMENT_APP_ID } from '../constants';
33
const {
44
getAccountsFromSearchParams,
55
getAppId,
@@ -158,10 +158,18 @@ describe('Get Server Config', () => {
158158
jest.clearAllMocks();
159159
});
160160

161+
describe('Given we are in SSR ( no browser object ) ', () => {
162+
it('Should return default ws server url and appId while SSR', () => {
163+
jest.spyOn(utils, 'getIsBrowser').mockReturnValueOnce(false);
164+
const serverConfig = getServerConfig();
165+
expect(serverConfig.appId).toEqual(LOCALHOST_APP_ID);
166+
expect(serverConfig.serverUrl).toEqual(DEFAULT_WS_SERVER);
167+
});
168+
});
169+
161170
describe('Given we are in Browser', () => {
162171
jest.spyOn(utils, 'getIsBrowser').mockReturnValue(true);
163-
164-
it('Should return default ws server url and vercel deployment appId in LOCALHOST ', () => {
172+
it('Should return default ws server url and localhost appId', () => {
165173
const serverConfig = getServerConfig();
166174
expect(serverConfig.appId).toEqual(LOCALHOST_APP_ID);
167175
expect(serverConfig.serverUrl).toEqual(DEFAULT_WS_SERVER);

0 commit comments

Comments
 (0)