-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
29 lines (25 loc) · 846 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import test from 'ava';
import { getSEO } from './dist/getSEO.js';
const TEST_URL = 'https://github.com/maaaathis/maaaathis';
test('invalid url', async (t) => {
try {
const seoGetter = new getSEO('abcdefgh');
await seoGetter.getTitle();
t.fail('Expected an error, but none was thrown');
} catch (error) {
t.pass('Error was thrown as expected');
}
});
test('title', async (t) => {
const seoGetter = new getSEO(TEST_URL);
const title = await seoGetter.getTitle();
t.is(title, 'GitHub - maaaathis/maaaathis: Personal GitHub Profile');
});
test('description', async (t) => {
const seoGetter = new getSEO(TEST_URL);
const description = await seoGetter.getDescription();
t.is(
description,
'Personal GitHub Profile. Contribute to maaaathis/maaaathis development by creating an account on GitHub.'
);
});