-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathParserTest.js
More file actions
52 lines (40 loc) · 1.62 KB
/
ParserTest.js
File metadata and controls
52 lines (40 loc) · 1.62 KB
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
44
45
46
47
48
49
50
51
52
const {describe, it} = (exports.lab = require('lab').script());
const expect = require('code').expect;
const Parser = require('../../src/Parser');
describe('Parser Class', () => {
describe('Creating Parse with string', () => {
it('should work', (done) => {
const parser = new Parser('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; InfoPath.1)');
expect(parser).to.be.instanceOf(Parser);
expect(parser.isBrowser('Internet Explorer', '=', '6.0')).to.be.true();
done();
});
});
describe('Creating Parse with headers object', () => {
it('should work', (done) => {
const parser = new Parser({'User-Agent': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; InfoPath.1)'});
expect(parser).to.be.instanceOf(Parser);
expect(parser.isBrowser('Internet Explorer', '=', '6.0')).to.be.true();
done();
});
});
describe('Creating Parse with options', () => {
it('should work', (done) => {
const parser = new Parser({
headers: {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; InfoPath.1)'},
});
expect(parser).to.be.instanceOf(Parser);
expect(parser.isBrowser('Internet Explorer', '=', '6.0')).to.be.true();
done();
});
});
describe('Creating Parse without arguments', () => {
it('an calling analyse should work', (done) => {
const parser = new Parser();
parser.analyse('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; InfoPath.1)');
expect(parser).to.be.instanceOf(Parser);
expect(parser.isBrowser('Internet Explorer', '=', '6.0')).to.be.true();
done();
});
});
});