Skip to content

Commit 81c6ba5

Browse files
committed
test case for user agent
1 parent fa3c493 commit 81c6ba5

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

tests/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
"coffee-script": "1.2",
2020
"mocha": "1.7.4"
2121
},
22-
"chromium-args": "disable-javascript-i18n-api"
22+
"chromium-args": "disable-javascript-i18n-api",
23+
"user-agent": "%name/%nwver/%ver/%webkit_ver/%osinfo"
2324
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var assert = require('assert');
2+
var fs = require('fs');
3+
describe('user-agent', function() {
4+
var user_agent = navigator.userAgent.split('/');
5+
var package_info = JSON.parse(fs.readFileSync('package.json', 'utf8'));
6+
it('name should be same to the one in package.json',
7+
function() {
8+
assert.equal(user_agent[0], package_info.name);
9+
}
10+
)
11+
12+
it('version should be same to the one in package.json',
13+
function() {
14+
assert.equal(user_agent[2], package_info.version);
15+
}
16+
)
17+
})

0 commit comments

Comments
 (0)