-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
33 lines (25 loc) · 793 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
30
31
32
33
'use strict';
var brokenLink = require('./');
var test = require('tape');
var timestamp = +new Date();
test('check broken links', function (t) {
t.test('totally broken link should be broken', function(t) {
t.plan(1);
brokenLink('http://www.totally-broken-link.com/foo').then(function(answer) {
t.equal(answer, true);
});
});
t.test('Google\'s main page should not be broken', function(t) {
t.plan(1);
brokenLink('http://google.com', {allowRedirects: true}).then(function(answer) {
t.equal(answer, false);
});
});
t.test('Google\'s invalid page should be broken', function(t) {
t.plan(1);
brokenLink('http://google.com/' + timestamp).then(function(answer) {
t.equal(answer, true);
});
});
t.end();
});