From d4a88f403ea4d34348575a20cf71c168630c771a Mon Sep 17 00:00:00 2001 From: Hiranya Jayathilaka Date: Fri, 14 Sep 2018 14:58:20 -0700 Subject: [PATCH] Integration test improvements (#356) --- package.json | 2 +- test/integration/auth.spec.ts | 2 +- test/integration/firestore.spec.ts | 8 ++++---- test/integration/storage.spec.ts | 4 ++-- test/integration/typescript/src/example.test.ts | 4 ++++ 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 33bf33c8be..9832c9aa64 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "test": "run-s lint test:unit", "integration": "run-s build test:integration", "test:unit": "mocha test/unit/*.spec.ts --require ts-node/register", - "test:integration": "mocha test/integration/*.ts --slow 5000 --timeout 5000 --require ts-node/register", + "test:integration": "mocha test/integration/*.ts --slow 5000 --timeout 20000 --require ts-node/register", "test:coverage": "nyc npm run test:unit", "lint:src": "tslint --format stylish -p tsconfig.json", "lint:unit": "tslint -c tslint-test.json --format stylish test/unit/*.ts test/unit/**/*.ts", diff --git a/test/integration/auth.spec.ts b/test/integration/auth.spec.ts index 3961fee05b..38fce8a122 100644 --- a/test/integration/auth.spec.ts +++ b/test/integration/auth.spec.ts @@ -220,7 +220,7 @@ describe('admin.auth', () => { return admin.auth().verifyIdToken(idToken, true) .should.eventually.be.fulfilled; }); - }).timeout(10000); + }); it('setCustomUserClaims() sets claims that are accessible via user\'s ID token', () => { // Set custom claims on the user. diff --git a/test/integration/firestore.spec.ts b/test/integration/firestore.spec.ts index 9c43eb7a37..a64fa7c431 100644 --- a/test/integration/firestore.spec.ts +++ b/test/integration/firestore.spec.ts @@ -65,7 +65,7 @@ describe('admin.firestore', () => { .then((snapshot) => { expect(snapshot.exists).to.be.false; }); - }).timeout(5000); + }); it('admin.firestore.FieldValue.serverTimestamp() provides a server-side timestamp', () => { const expected: any = clone(mountainView); @@ -81,7 +81,7 @@ describe('admin.firestore', () => { return reference.delete(); }) .should.eventually.be.fulfilled; - }).timeout(5000); + }); it('admin.firestore.CollectionReference type is defined', () => { expect(typeof admin.firestore.CollectionReference).to.be.not.undefined; @@ -132,7 +132,7 @@ describe('admin.firestore', () => { return Promise.all(promises); }) .should.eventually.be.fulfilled; - }).timeout(5000); + }); it('admin.firestore.setLogFunction() enables logging for the Firestore module', () => { const logs = []; @@ -147,5 +147,5 @@ describe('admin.firestore', () => { .then((result) => { expect(logs.length).greaterThan(0); }); - }).timeout(5000); + }); }); diff --git a/test/integration/storage.spec.ts b/test/integration/storage.spec.ts index 284297e4f5..de6150f7a7 100644 --- a/test/integration/storage.spec.ts +++ b/test/integration/storage.spec.ts @@ -31,13 +31,13 @@ describe('admin.storage', () => { const bucket: Bucket = admin.storage().bucket(); return verifyBucket(bucket, 'storage().bucket()') .should.eventually.be.fulfilled; - }).timeout(5000); + }); it('bucket(string) returns a handle to the specified bucket', () => { const bucket: Bucket = admin.storage().bucket(projectId + '.appspot.com'); return verifyBucket(bucket, 'storage().bucket(string)') .should.eventually.be.fulfilled; - }).timeout(5000); + }); it('bucket(non-existing) returns a handle which can be queried for existence', () => { const bucket: Bucket = admin.storage().bucket('non.existing'); diff --git a/test/integration/typescript/src/example.test.ts b/test/integration/typescript/src/example.test.ts index b52e203f5c..d630936e4e 100644 --- a/test/integration/typescript/src/example.test.ts +++ b/test/integration/typescript/src/example.test.ts @@ -26,6 +26,10 @@ const serviceAccount = require('../mock.key.json'); describe('Init App', () => { const app: admin.app.App = initApp(serviceAccount, 'TestApp'); + after(() => { + return app.delete(); + }); + it('Should return an initialized App', () => { expect(app.name).to.equal('TestApp'); });