Skip to content

Commit dc12948

Browse files
committed
Added tests
1 parent 117d33b commit dc12948

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,27 @@ describe('Database Tests', () => {
272272
});
273273

274274
it('refFromURL() validates argument', () => {
275+
// TODO: Remove all any references
275276
const db = (firebase as any).database();
276277
expect(() => {
277278
const ref = (db as any).refFromURL();
278279
}).to.throw(/Expects at least 1/);
279280
});
280281

281282
it('can call useEmulator before use', () => {
282-
const db = (firebase as any).database();
283+
const db = firebase.database();
284+
// Cast as any as _delegate isn't a public property
283285
db.useEmulator('localhost', 1234);
286+
// Cast as any as _delegate isn't a public property
287+
expect((db as any)._delegate._repo.repoInfo_.isUsingEmulator).to.be.true;
284288
expect(db.ref().toString()).to.equal('http://localhost:1234/');
285289
});
286290

291+
it('initializes usingEmulator to false before use', () => {
292+
const db = firebase.database();
293+
expect((db as any)._delegate._repo.repoInfo_.isUsingEmulator).to.be.false;
294+
});
295+
287296
it('cannot call useEmulator after use', () => {
288297
const db = (firebase as any).database();
289298

0 commit comments

Comments
 (0)