Skip to content

Commit

Permalink
chore: refactor cloud sql server test (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
sofisl authored Apr 1, 2020
1 parent 72631ea commit 617bc86
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 5 additions & 4 deletions appengine/cloudsql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@
"node": ">=8.0.0"
},
"scripts": {
"unit-test": "mocha test/*.test.js --timeout=60000",
"unit-test": "mocha test/createTables.test.js --timeout=60000 && mocha test/server.test.js",
"start-proxy": "! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &",
"system-test": "repo-tools test app -- server.js",
"system-test": "mocha test/serverListening.test.js --exit",
"system-test-proxy": "npm run start-proxy; npm run system-test",
"all-test": "npm run unit-test && npm run system-test",
"test": "npm -- run all-test"
},
"dependencies": {
"chai": "^4.2.0",
"express": "^4.16.4",
"knex": "^0.20.0",
"mysql": "^2.16.0",
"prompt": "^1.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0",
"mocha": "^7.0.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.0",
"supertest": "^4.0.0"
"supertest": "^4.0.0",
"wait-port": "^0.2.7"
},
"cloud-repo-tools": {
"requiresKeyFile": true,
Expand Down
10 changes: 10 additions & 0 deletions appengine/cloudsql/test/serverListening.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const waitPort = require('wait-port');
const {expect} = require('chai');

describe('server listening', () => {
it('should be listening', async () => {
require('../server.js');
const isOpen = await waitPort({port: 8080});
expect(isOpen).to.be.true;
});
});

0 comments on commit 617bc86

Please sign in to comment.