diff --git a/endpoints/getting-started/package.json b/endpoints/getting-started/package.json index b91488a8ce..0ca69e230a 100644 --- a/endpoints/getting-started/package.json +++ b/endpoints/getting-started/package.json @@ -14,7 +14,7 @@ }, "scripts": { "start": "node app.js", - "test": "repo-tools test run --cmd ava -- -T 20s --verbose test/*.test.js" + "test": "repo-tools test run --cmd mocha -- test/*.test.js --timeout=20000" }, "dependencies": { "body-parser": "^1.18.3", @@ -23,7 +23,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", - "ava": "^0.25.0", + "mocha": "^6.0.0", "proxyquire": "^2.1.0", "sinon": "^7.2.7", "supertest": "^4.0.0" diff --git a/endpoints/getting-started/test/app.test.js b/endpoints/getting-started/test/app.test.js index a9c2590ab4..1cfd5526d5 100644 --- a/endpoints/getting-started/test/app.test.js +++ b/endpoints/getting-started/test/app.test.js @@ -21,7 +21,7 @@ const path = require('path'); const proxyquire = require('proxyquire').noPreserveCache(); const request = require('supertest'); const sinon = require('sinon'); -const test = require('ava'); +const assert = require('assert'); const tools = require('@google-cloud/nodejs-repo-tools'); const SAMPLE_PATH = path.join(__dirname, '../app.js'); @@ -42,32 +42,30 @@ function getSample() { }; } -test.beforeEach(tools.stubConsole); -test.afterEach.always(tools.restoreConsole); +beforeEach(tools.stubConsole); +afterEach(tools.restoreConsole); -test.cb('should echo a message', t => { - request(getSample().app) +it('should echo a message', async () => { + await request(getSample().app) .post('/echo') .send({message: 'foo'}) .expect(200) .expect(response => { - t.is(response.body.message, 'foo'); - }) - .end(t.end); + assert.strictEqual(response.body.message, 'foo'); + }); }); -test.cb('should try to parse encoded info', t => { - request(getSample().app) +it('should try to parse encoded info', async () => { + await request(getSample().app) .get('/auth/info/googlejwt') .expect(200) .expect(response => { - t.deepEqual(response.body, {id: 'anonymous'}); - }) - .end(t.end); + assert.deepStrictEqual(response.body, {id: 'anonymous'}); + }); }); -test.cb('should successfully parse encoded info', t => { - request(getSample().app) +it('should successfully parse encoded info', async () => { + await request(getSample().app) .get('/auth/info/googlejwt') .set( 'X-Endpoint-API-UserInfo', @@ -75,7 +73,6 @@ test.cb('should successfully parse encoded info', t => { ) .expect(200) .expect(response => { - t.deepEqual(response.body, {id: 'foo'}); - }) - .end(t.end); + assert.deepStrictEqual(response.body, {id: 'foo'}); + }); });