Skip to content

chore:refactor memcached test #1698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 11 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
4 changes: 3 additions & 1 deletion appengine/memcached/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ app.get('/', async (req, res, next) => {
});

const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
const server = app.listen(PORT, () => {
console.log(`App listening on port ${PORT}`);
console.log('Press Ctrl+C to quit.');
});

module.exports = server;
6 changes: 4 additions & 2 deletions appengine/memcached/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
},
"scripts": {
"start": "node app.js",
"test": "repo-tools test app"
"test": "mocha --exit test/*.test.js"
},
"dependencies": {
"express": "^4.16.4",
"memjs": "^1.2.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.3.0"
"chai": "^4.2.0",
"mocha": "^7.1.1",
"wait-port": "^0.2.7"
}
}
13 changes: 13 additions & 0 deletions appengine/memcached/test/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const waitPort = require('wait-port');
const {expect} = require('chai');

const PORT = process.env.PORT || 8080;

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