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
+ */
2
17
3
- import { APPLICATION_ID_PARAM } from "../src/realtime/Constants" ;
4
- import { WebSocketConnection } from "../src/realtime/WebSocketConnection" ;
18
+ import { expect } from 'chai' ;
5
19
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' ;
7
24
8
25
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