Skip to content

Commit 77ad14f

Browse files
committed
Fixed formatting
1 parent e1e7ee2 commit 77ad14f

File tree

2 files changed

+46
-22
lines changed

2 files changed

+46
-22
lines changed

packages/database/src/realtime/WebSocketConnection.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class WebSocketConnection implements Transport {
140140
if (appCheckToken) {
141141
urlParams[APP_CHECK_TOKEN_PARAM] = appCheckToken;
142142
}
143-
if(applicationId) {
143+
if (applicationId) {
144144
urlParams[APPLICATION_ID_PARAM] = applicationId;
145145
}
146146

@@ -195,9 +195,8 @@ export class WebSocketConnection implements Transport {
195195
if (proxy) {
196196
options['proxy'] = { origin: proxy };
197197
}
198-
199198
}
200-
this.mySock = new WebSocketImpl(this.connURL, [], options);
199+
this.mySock = new WebSocketImpl(this.connURL, [], options);
201200
} catch (e) {
202201
this.log_('Error instantiating WebSocket.');
203202
const error = e.message || e.data;
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
1-
import { expect } from "chai";
1+
/**
2+
* @license
3+
* Copyright 2022 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
217

3-
import { APPLICATION_ID_PARAM } from "../src/realtime/Constants";
4-
import { WebSocketConnection } from "../src/realtime/WebSocketConnection";
18+
import { expect } from 'chai';
519

6-
import { testRepoInfo } from "./helpers/util";
20+
import { APPLICATION_ID_PARAM } from '../src/realtime/Constants';
21+
import { WebSocketConnection } from '../src/realtime/WebSocketConnection';
22+
23+
import { testRepoInfo } from './helpers/util';
724

825
describe('WebSocketConnection', () => {
9-
it('should add an applicationId to the query parameter', () => {
10-
const repoInfo = testRepoInfo('https://test-ns.firebaseio.com');
11-
const applicationId = 'myID';
12-
const websocketConnection = new WebSocketConnection('connId', repoInfo, applicationId);
13-
const searchParams = new URL(websocketConnection.connURL).searchParams;
14-
expect(searchParams.get(APPLICATION_ID_PARAM)).to.equal(applicationId);
15-
});
16-
it('should not add an applicationId to the query parameter if applicationId is empty', () => {
17-
const repoInfo = testRepoInfo('https://test-ns.firebaseio.com');
18-
const applicationId = '';
19-
const websocketConnection = new WebSocketConnection('connId', repoInfo, applicationId);
20-
const searchParams = new URL(websocketConnection.connURL).searchParams;
21-
expect(searchParams.get(APPLICATION_ID_PARAM)).to.be.null;
22-
});
23-
});
26+
it('should add an applicationId to the query parameter', () => {
27+
const repoInfo = testRepoInfo('https://test-ns.firebaseio.com');
28+
const applicationId = 'myID';
29+
const websocketConnection = new WebSocketConnection(
30+
'connId',
31+
repoInfo,
32+
applicationId
33+
);
34+
const searchParams = new URL(websocketConnection.connURL).searchParams;
35+
expect(searchParams.get(APPLICATION_ID_PARAM)).to.equal(applicationId);
36+
});
37+
it('should not add an applicationId to the query parameter if applicationId is empty', () => {
38+
const repoInfo = testRepoInfo('https://test-ns.firebaseio.com');
39+
const applicationId = '';
40+
const websocketConnection = new WebSocketConnection(
41+
'connId',
42+
repoInfo,
43+
applicationId
44+
);
45+
const searchParams = new URL(websocketConnection.connURL).searchParams;
46+
expect(searchParams.get(APPLICATION_ID_PARAM)).to.be.null;
47+
});
48+
});

0 commit comments

Comments
 (0)