From f54a37db50035c856ad47cdb9b422e3c8e9c90c8 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Thu, 25 Jul 2019 21:25:51 -0400 Subject: [PATCH] Remove repo-tools from appengine/hello-world/flex (#1432) --- appengine/hello-world/flexible/README.md | 2 +- appengine/hello-world/flexible/app.js | 2 ++ appengine/hello-world/flexible/package.json | 17 +++-------------- appengine/hello-world/flexible/test/app.test.js | 16 ++++++++++++++++ appengine/hello-world/standard/package.json | 3 +-- 5 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 appengine/hello-world/flexible/test/app.test.js diff --git a/appengine/hello-world/flexible/README.md b/appengine/hello-world/flexible/README.md index ae79034d26..1b7e929822 100644 --- a/appengine/hello-world/flexible/README.md +++ b/appengine/hello-world/flexible/README.md @@ -26,7 +26,7 @@ Before you can run or deploy the sample, you need to do the following: ## Deploying to App Engine - npm run deploy + gcloud app deploy ## Running the tests diff --git a/appengine/hello-world/flexible/app.js b/appengine/hello-world/flexible/app.js index ad6fb61bba..86489edcd9 100644 --- a/appengine/hello-world/flexible/app.js +++ b/appengine/hello-world/flexible/app.js @@ -34,3 +34,5 @@ app.listen(PORT, () => { console.log('Press Ctrl+C to quit.'); }); // [END gae_flex_quickstart] + +module.exports = app; diff --git a/appengine/hello-world/flexible/package.json b/appengine/hello-world/flexible/package.json index 0170bf99f9..fdf7ff05ff 100644 --- a/appengine/hello-world/flexible/package.json +++ b/appengine/hello-world/flexible/package.json @@ -13,25 +13,14 @@ "node": ">=8.0.0" }, "scripts": { - "deploy": "gcloud app deploy", "start": "node app.js", - "system-test": "repo-tools test app", - "test": "npm run system-test", - "e2e-test": "repo-tools test deploy" + "test": "mocha --exit test/*.test.js" }, "dependencies": { "express": "^4.16.3" }, "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.3.0" - }, - "cloud-repo-tools": { - "test": { - "app": { - "msg": "Hello, world!" - } - }, - "requiresKeyFile": true, - "requiresProjectId": true + "mocha": "^6.2.0", + "supertest": "^4.0.2" } } diff --git a/appengine/hello-world/flexible/test/app.test.js b/appengine/hello-world/flexible/test/app.test.js new file mode 100644 index 0000000000..3bf7b9c3a8 --- /dev/null +++ b/appengine/hello-world/flexible/test/app.test.js @@ -0,0 +1,16 @@ +const app = require('../app'); + +const request = require('supertest'); + +describe('GET /', () => { + it('should get 200', done => { + request(app) + .get('/') + .expect(200, done); + }), + it('should get Hello World', done => { + request(app) + .get('/') + .expect('Hello, world!', done); + }); +}); diff --git a/appengine/hello-world/standard/package.json b/appengine/hello-world/standard/package.json index 6512caf252..1c1a447e3f 100644 --- a/appengine/hello-world/standard/package.json +++ b/appengine/hello-world/standard/package.json @@ -14,8 +14,7 @@ }, "scripts": { "start": "node app.js", - "system-test": "mocha --exit test/*.test.js", - "test": "npm run system-test" + "test": "mocha --exit test/*.test.js" }, "dependencies": { "express": "^4.16.3"