forked from omrilotan/isbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
26 lines (23 loc) · 803 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 fs = require('fs');
var path = require('path');
var chai = require("chai");
chai.should();
var crawlersFile = path.join(__dirname, 'crawlers.txt');
var browsersFile = path.join(__dirname, 'browsers.txt');
var crawlers = fs.readFileSync(crawlersFile, 'utf-8').trim().split('\n');
var browsers = fs.readFileSync(browsersFile, 'utf-8').trim().split('\n');
var isBot = require('./');
describe('Crawlers:', function() {
crawlers.forEach(function(bot) {
it('should detect (' + bot + ') as bot', function() {
isBot(bot).should.be.true;
});
});
});
describe('Browsers:', function() {
browsers.forEach(function(browser) {
it('should not be detected (' + browser + ') as bot', function() {
isBot(browser).should.be.false;
});
});
});