From c0c51027d1e6f68640b3db89ab3c8f49cd7b446d Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 8 Feb 2017 17:27:16 +0900 Subject: [PATCH] =?UTF-8?q?[Test]=20=E3=81=84=E3=81=84=E6=84=9F=E3=81=98?= =?UTF-8?q?=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/htmls/og-description.html | 2 +- test/index.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/htmls/og-description.html b/test/htmls/og-description.html index f8afda6..e036893 100644 --- a/test/htmls/og-description.html +++ b/test/htmls/og-description.html @@ -3,7 +3,7 @@ - + YEE HAW diff --git a/test/index.js b/test/index.js index 67c77d0..b251395 100644 --- a/test/index.js +++ b/test/index.js @@ -24,13 +24,27 @@ process.on('unhandledRejection', console.dir); describe('OGP', () => { it('title', done => { - const server = express(); - server.use((req, res) => { + const app = express(); + app.use((req, res) => { res.sendFile(__dirname + '/htmls/og-title.html'); }); - server.listen(80, async () => { + const server = app.listen(80, async () => { const summary = await summaly('http://localhost'); assert.equal(summary.title, 'Strawberry Pasta'); + server.close(); + done(); + }); + }); + + it('description', done => { + const app = express(); + app.use((req, res) => { + res.sendFile(__dirname + '/htmls/og-description.html'); + }); + const server = app.listen(80, async () => { + const summary = await summaly('http://localhost'); + assert.equal(summary.description, 'Strawberry Pasta'); + server.close(); done(); }); });