Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/unit/firestore/firestore.spec.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,7 @@

'use strict';

import path = require('path');
import * as _ from 'lodash';
import {expect} from 'chai';

Expand All@@ -38,6 +39,8 @@ describe('Firestore', () => {
+ 'credentials. Must initialize the SDK with a certificate credential or application default '
+ 'credentials to use Cloud Firestore API.';

const mockServiceAccount = path.resolve(__dirname, '../../resources/mock.key.json');

beforeEach(() => {
appCredentials = process.env.GOOGLE_APPLICATION_CREDENTIALS;
gcloudProject = process.env.GCLOUD_PROJECT;
Expand DownExpand Up@@ -104,6 +107,7 @@ describe('Firestore', () => {
it('should not throw given application default credentials without project ID', () => {
// Project ID not set in the environment.
delete process.env.GCLOUD_PROJECT;
process.env.GOOGLE_APPLICATION_CREDENTIALS = mockServiceAccount;
expect(() => {
return new FirestoreService(defaultCredentialApp);
}).not.to.throw();
Expand DownExpand Up@@ -147,6 +151,7 @@ describe('Firestore', () => {

it('should return a string when project ID is present in environment', () => {
process.env.GCLOUD_PROJECT = 'env-project-id';
process.env.GOOGLE_APPLICATION_CREDENTIALS = mockServiceAccount;
expect((new FirestoreService(defaultCredentialApp).client as any).projectId).to.equal('env-project-id');
});
});
Expand Down