From e994fb366d69e2b1c74809dec1d18fb5b81dc273 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Mon, 10 Mar 2025 12:20:36 -0700 Subject: [PATCH 1/3] chore: fix formatting, github workflow deprecation, and missing changelog. --- .github/workflows/test.yaml | 22 ++++++++++-------- CHANGELOG.md | 1 + spec/providers/firestore.spec.ts | 40 ++++++++++++++++++-------------- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1a8c0f8..b307f23 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,16 +13,17 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.x + - 18.x + - 20.x + - 22.x steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Cache npm - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} @@ -36,16 +37,17 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.x + - 18.x + - 20.x + - 22.x steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Cache npm - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..438278a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- fix(firestore): use hostname from env variable (#184) diff --git a/spec/providers/firestore.spec.ts b/spec/providers/firestore.spec.ts index 420252b..174bd0d 100644 --- a/spec/providers/firestore.spec.ts +++ b/spec/providers/firestore.spec.ts @@ -14,7 +14,7 @@ describe('providers/firestore', () => { test = fft(); fakeHttpResponse = { statusCode: 200, - on: ((event, cb) => cb()) + on: (event, cb) => cb(), }; fakeHttpRequestMethod = sinon.fake((config, cb) => { cb(fakeHttpResponse); @@ -91,26 +91,32 @@ describe('providers/firestore', () => { it('should use host name from FIRESTORE_EMULATOR_HOST env in clearFirestoreData', async () => { process.env.FIRESTORE_EMULATOR_HOST = 'not-local-host:8080'; - await test.firestore.clearFirestoreData({projectId: 'not-a-project'}); - - expect(fakeHttpRequestMethod.calledOnceWith({ - hostname: 'not-local-host', - method: 'DELETE', - path: '/emulator/v1/projects/not-a-project/databases/(default)/documents', - port: '8080' - })).to.be.true; + await test.firestore.clearFirestoreData({ projectId: 'not-a-project' }); + + expect( + fakeHttpRequestMethod.calledOnceWith({ + hostname: 'not-local-host', + method: 'DELETE', + path: + '/emulator/v1/projects/not-a-project/databases/(default)/documents', + port: '8080', + }) + ).to.be.true; }); it('should use host name from FIREBASE_FIRESTORE_EMULATOR_ADDRESS env in clearFirestoreData', async () => { process.env.FIREBASE_FIRESTORE_EMULATOR_ADDRESS = 'custom-host:9090'; - await test.firestore.clearFirestoreData({projectId: 'not-a-project'}); - - expect(fakeHttpRequestMethod.calledOnceWith({ - hostname: 'custom-host', - method: 'DELETE', - path: '/emulator/v1/projects/not-a-project/databases/(default)/documents', - port: '9090' - })).to.be.true; + await test.firestore.clearFirestoreData({ projectId: 'not-a-project' }); + + expect( + fakeHttpRequestMethod.calledOnceWith({ + hostname: 'custom-host', + method: 'DELETE', + path: + '/emulator/v1/projects/not-a-project/databases/(default)/documents', + port: '9090', + }) + ).to.be.true; }); }); From cfd207e16d8d9543e944e45e2c8dfd9e95b8d809 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Mon, 10 Mar 2025 12:26:03 -0700 Subject: [PATCH 2/3] Cut nodejs18. --- .github/workflows/test.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b307f23..76dd3bd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,7 +13,6 @@ jobs: strategy: matrix: node-version: - - 18.x - 20.x - 22.x steps: @@ -37,7 +36,6 @@ jobs: strategy: matrix: node-version: - - 18.x - 20.x - 22.x steps: From 308d93b2d01eb20259b452beb2863027d2433197 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Mon, 10 Mar 2025 14:49:11 -0700 Subject: [PATCH 3/3] Use more description changelog. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 438278a..a320b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1 @@ -- fix(firestore): use hostname from env variable (#184) +- Support FIRESTORE_EMULATOR_HOST env var for Firestore triggers (#184)