[Test] Add the og:image test

This commit is contained in:
syuilo 2017-02-08 17:41:49 +09:00
parent c0c51027d1
commit 9880b415de
2 changed files with 26 additions and 0 deletions

13
test/htmls/og-image.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta property="og:image" content="https://himasaku.net/himasaku.png">
<title>YEE HAW</title>
</head>
<body>
<h1>Yo</h1>
<p>Hey hey hey syuilo.</p>
</body>
</html>

View File

@ -48,4 +48,17 @@ describe('OGP', () => {
done();
});
});
it('thumbnail', done => {
const app = express();
app.use((req, res) => {
res.sendFile(__dirname + '/htmls/og-image.html');
});
const server = app.listen(80, async () => {
const summary = await summaly('http://localhost');
assert.equal(summary.thumbnail, 'https://himasaku.net/himasaku.png');
server.close();
done();
});
});
});