From a84e73b958a610963e6b6ba2d16eeb81559bb7f3 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Wed, 2 Feb 2022 01:23:40 -0500 Subject: [PATCH] tests: add test for hello-world example --- examples/hello-world/index.js | 2 +- test/acceptance/hello-world.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/acceptance/hello-world.js diff --git a/examples/hello-world/index.js b/examples/hello-world/index.js index 04382ac3..d82452f3 100644 --- a/examples/hello-world/index.js +++ b/examples/hello-world/index.js @@ -1,6 +1,6 @@ var express = require('../../'); -var app = express(); +var app = module.exports = express() app.get('/', function(req, res){ res.send('Hello World'); diff --git a/test/acceptance/hello-world.js b/test/acceptance/hello-world.js new file mode 100644 index 00000000..db90349c --- /dev/null +++ b/test/acceptance/hello-world.js @@ -0,0 +1,21 @@ + +var app = require('../../examples/hello-world') +var request = require('supertest') + +describe('hello-world', function () { + describe('GET /', function () { + it('should respond with hello world', function (done) { + request(app) + .get('/') + .expect(200, 'Hello World', done) + }) + }) + + describe('GET /missing', function () { + it('should respond with 404', function (done) { + request(app) + .get('/missing') + .expect(404, done) + }) + }) +}) -- 2.11.4.GIT