added simple test case (mocha)

This commit is contained in:
John Tantalo 2012-11-27 20:44:37 -08:00
parent ea9d093f0d
commit 08c7a84407
3 changed files with 17 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

View File

@ -17,6 +17,12 @@
"Faisal Salman <fyzlman@gmail.com>"
],
"main": "ua-parser",
"scripts": {
"test": "./node_modules/mocha/bin/mocha"
},
"devDependencies": {
"mocha": ">= 1.7.1"
},
"repositories": [
{
"type": "git",

10
test.js Normal file
View File

@ -0,0 +1,10 @@
var assert = require("assert");
var UAParser = require("./ua-parser");
describe('getDevice', function () {
it('should return the model', function () {
var parser = new UAParser('Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.11 (KHTML, like Gecko) Version/7.1.0.7 Safari/534.11');
var device = parser.getDevice();
assert.equal(device.model, "PlayBook");
});
});