diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1a8c0f8..76dd3bd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,16 +13,16 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.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 +36,16 @@ jobs: strategy: matrix: node-version: - - 14.x - - 16.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..a320b1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Support FIRESTORE_EMULATOR_HOST env var for Firestore triggers (#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; }); });