forked from XCSoar/xcsoar-data-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
26 lines (20 loc) · 746 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
var request = require('request');
var repository = require('./');
repository.sections.forEach(describeSection);
function describeSection(section) {
describe(section.title, function() {
section.records.forEach(checkRecord);
});
}
function checkRecord(record) {
it(record.name, function(done) {
this.timeout(10000);
var r = request.head(record.uri, function (error, response) {
if (error && error.code != 'HPE_INVALID_CONSTANT')
throw new Error(record.uri + ' failed with ' + error);
if (r.response.statusCode != 200)
throw new Error(record.uri + ' returned with HTTP status code ' + r.response.statusCode);
done();
});
});
}