mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-05-30 01:47:17 +09:00
[Test] Add some twitter cards tests
This commit is contained in:
parent
814a5eb092
commit
ac5e6230f6
13
test/htmls/twitter-description.html
Normal file
13
test/htmls/twitter-description.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta property="twitter:description" content="Strawberry Pasta">
|
||||
<title>YEE HAW</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Yo</h1>
|
||||
<p>Hey hey hey syuilo.</p>
|
||||
</body>
|
||||
</html>
|
13
test/htmls/twitter-image.html
Normal file
13
test/htmls/twitter-image.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta property="twitter:image" content="https://himasaku.net/himasaku.png">
|
||||
<title>YEE HAW</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Yo</h1>
|
||||
<p>Hey hey hey syuilo.</p>
|
||||
</body>
|
||||
</html>
|
13
test/htmls/twitter-title.html
Normal file
13
test/htmls/twitter-title.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta property="twitter:title" content="Strawberry Pasta">
|
||||
<title>YEE HAW</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Yo</h1>
|
||||
<p>Hey hey hey syuilo.</p>
|
||||
</body>
|
||||
</html>
|
@ -78,3 +78,44 @@ describe('OGP', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('TwitterCard', () => {
|
||||
it('title', done => {
|
||||
const app = express();
|
||||
app.use((req, res) => {
|
||||
res.sendFile(__dirname + '/htmls/twitter-title.html');
|
||||
});
|
||||
const server = app.listen(port, async () => {
|
||||
const summary = await summaly(host);
|
||||
assert.equal(summary.title, 'Strawberry Pasta');
|
||||
server.close();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('description', done => {
|
||||
const app = express();
|
||||
app.use((req, res) => {
|
||||
res.sendFile(__dirname + '/htmls/twitter-description.html');
|
||||
});
|
||||
const server = app.listen(port, async () => {
|
||||
const summary = await summaly(host);
|
||||
assert.equal(summary.description, 'Strawberry Pasta');
|
||||
server.close();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('thumbnail', done => {
|
||||
const app = express();
|
||||
app.use((req, res) => {
|
||||
res.sendFile(__dirname + '/htmls/twitter-image.html');
|
||||
});
|
||||
const server = app.listen(port, async () => {
|
||||
const summary = await summaly(host);
|
||||
assert.equal(summary.thumbnail, 'https://himasaku.net/himasaku.png');
|
||||
server.close();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user