Skip to content

Commit d67b284

Browse files
committed
Updated useEmulator
1 parent a1b85e2 commit d67b284

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

.changeset/gentle-laws-kneel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
---
22
"@firebase/database-compat": patch
3+
"@firebase/database-types": patch
34
"@firebase/database": patch
45
"@firebase/firestore": patch
6+
"@firebase/functions": patch
57
---
68

79
Add SSL checks to `connectDatabaseEmulator` and `connectFirestoreEmulator`

common/api-review/database.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function child(parent: DatabaseReference, path: string): DatabaseReferenc
1313
// @public
1414
export function connectDatabaseEmulator(db: Database, host: string, port: number, options?: {
1515
mockUserToken?: EmulatorMockTokenOptions | string;
16+
ssl?: boolean;
1617
}): void;
1718

1819
// @public

packages/database-compat/src/api/Database.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class Database implements FirebaseService, Compat<ModularDatabase> {
7272
port: number,
7373
options: {
7474
mockUserToken?: EmulatorMockTokenOptions;
75+
ssl?: boolean;
7576
} = {}
7677
): void {
7778
connectDatabaseEmulator(this._delegate, host, port, options);

packages/database-compat/test/database.test.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,9 @@ describe('Database Tests', () => {
292292
expect((db as any)._delegate._repo.repoInfo_.isUsingEmulator).to.be.false;
293293
});
294294

295-
it('uses ssl when useEmulator is called with https is specified', () => {
295+
it('uses ssl when useEmulator is called with ssl specified', () => {
296296
const db = firebase.database();
297-
db.useEmulator('https://localhost', 80);
298-
expect((db as any)._delegate._repo.repoInfo_.isUsingEmulator).to.be.true;
299-
expect((db as any)._delegate._repo.repoInfo_.host).to.equal('localhost:80');
300-
expect((db as any)._delegate._repo.repoInfo_.secure).to.be.true;
301-
});
302-
303-
it('uses ssl when useEmulator is called with wss is specified', () => {
304-
const db = firebase.database();
305-
db.useEmulator('wss://localhost', 80);
297+
db.useEmulator('localhost', 80, { ssl: true });
306298
expect((db as any)._delegate._repo.repoInfo_.isUsingEmulator).to.be.true;
307299
expect((db as any)._delegate._repo.repoInfo_.host).to.equal('localhost:80');
308300
expect((db as any)._delegate._repo.repoInfo_.secure).to.be.true;

packages/database-types/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface Database {
4747
port: number,
4848
options?: {
4949
mockUserToken?: EmulatorMockTokenOptions | string;
50+
ssl?: boolean;
5051
}
5152
): void;
5253
goOffline(): void;
@@ -63,6 +64,7 @@ export class FirebaseDatabase implements Database {
6364
port: number,
6465
options?: {
6566
mockUserToken?: EmulatorMockTokenOptions | string;
67+
ssl?: boolean;
6668
}
6769
): void;
6870
goOffline(): void;

0 commit comments

Comments
 (0)