From 8a057df8f3ab670dbf8046a834f81ce6e5612734 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Fri, 11 Dec 2020 13:16:54 -0700 Subject: [PATCH 1/5] Fix refFromUrl when used with emulator --- packages/database/src/api/Database.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/database/src/api/Database.ts b/packages/database/src/api/Database.ts index 8d88521fcb2..185cdf9f832 100644 --- a/packages/database/src/api/Database.ts +++ b/packages/database/src/api/Database.ts @@ -156,7 +156,7 @@ export class Database implements FirebaseService { const repoInfo = parsedURL.repoInfo; if ( - !repoInfo.isCustomHost() && + !this.repo_.repoInfo_.isCustomHost() && repoInfo.host !== this.repo_.repoInfo_.host ) { fatal( From c3f100a1d2ea7500fafa49b97dc4f405faa36cba Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Fri, 11 Dec 2020 13:20:09 -0700 Subject: [PATCH 2/5] Create clever-kangaroos-hug.md --- .changeset/clever-kangaroos-hug.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/clever-kangaroos-hug.md diff --git a/.changeset/clever-kangaroos-hug.md b/.changeset/clever-kangaroos-hug.md new file mode 100644 index 00000000000..949f736cb5e --- /dev/null +++ b/.changeset/clever-kangaroos-hug.md @@ -0,0 +1,5 @@ +--- +"@firebase/database": patch +--- + +Fixex an issue that caused `refFromUrl` to reject production database URLs when `useEmulator` is used. From d3a8d6a2c12535d580f7191336a9bfd2f38c9334 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Fri, 11 Dec 2020 13:21:44 -0700 Subject: [PATCH 3/5] Update clever-kangaroos-hug.md --- .changeset/clever-kangaroos-hug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/clever-kangaroos-hug.md b/.changeset/clever-kangaroos-hug.md index 949f736cb5e..37354342ba1 100644 --- a/.changeset/clever-kangaroos-hug.md +++ b/.changeset/clever-kangaroos-hug.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fixex an issue that caused `refFromUrl` to reject production database URLs when `useEmulator` is used. +Fixex an issue that caused `refFromUrl()` to reject production database URLs when `useEmulator()` was used. From 34708b02b30ddf6888e07556c43c80e8655d938a Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Mon, 14 Dec 2020 10:53:58 -0700 Subject: [PATCH 4/5] Update .changeset/clever-kangaroos-hug.md Co-authored-by: Sam Stern --- .changeset/clever-kangaroos-hug.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/clever-kangaroos-hug.md b/.changeset/clever-kangaroos-hug.md index 37354342ba1..93639fee02b 100644 --- a/.changeset/clever-kangaroos-hug.md +++ b/.changeset/clever-kangaroos-hug.md @@ -2,4 +2,4 @@ "@firebase/database": patch --- -Fixex an issue that caused `refFromUrl()` to reject production database URLs when `useEmulator()` was used. +Fixes an issue that caused `refFromUrl()` to reject production database URLs when `useEmulator()` was used. From 17f65e49b96e2a79d8f664ad864be0174504d6e5 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 15 Dec 2020 14:50:19 -0700 Subject: [PATCH 5/5] Fix more tests --- packages/database/test/database.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/database/test/database.test.ts b/packages/database/test/database.test.ts index 719d4e3abd3..17b1b82c6c7 100644 --- a/packages/database/test/database.test.ts +++ b/packages/database/test/database.test.ts @@ -246,12 +246,12 @@ describe('Database Tests', () => { }); it('refFromURL() validates domain', () => { - const db = (firebase as any).database(); - expect(() => { - const ref = db.refFromURL( - 'https://thisisnotarealfirebase.firebaseio.com/path/to/data' - ); - }).to.throw(/does not match.*database/i); + const db = (firebase as any) + .app() + .database('https://thisisreal.firebaseio.com'); + expect(() => + db.refFromURL('https://thisisnotreal.firebaseio.com/path/to/data') + ).to.throw(/does not match.*database/i); }); it('refFromURL() validates argument', () => {