-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.js
43 lines (32 loc) · 866 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
34
35
36
37
38
39
40
41
42
43
'use strict';
var $ = require('cheerio');
var assert = require('assert');
var crawler = require('./index');
describe('getCountries()', function(){
this.timeout(0);
var items;
before(function(done) {
crawler.getCountries()
.then(function(response){
items = response;
done();
});
});
it('should return array of country items', function(){
assert(items.length);
});
describe('each element should contain the correct attrs', function(){
it('should have href attr', function(){
var element = $(items[0]);
assert(element.attr('href'));
});
it('should have title attr', function(){
var element = $(items[0]);
assert(element.attr('title'));
});
it('should have rel attr', function(){
var element = $(items[0]);
assert(element.attr('rel'));
});
});
});