Skip to content

Commit bcd21c5

Browse files
committed
add really basic tests
1 parent d6918fb commit bcd21c5

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
*.log
33
*.err
4+
.DS_Store

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "xhr",
33
"version": "1.4.1",
44
"description": "small xhr abstraction",
5-
"keywords": [],
5+
"keywords": ["xhr", "http", "xmlhttprequest", "xhr2", "browserify"],
66
"author": "Raynos <[email protected]>",
77
"repository": "git://github.com/Raynos/xhr.git",
88
"main": "index",
@@ -21,7 +21,9 @@
2121
"global": "~2.0.7"
2222
},
2323
"devDependencies": {
24-
"tap": "~0.3.1"
24+
"beefy": "^1.1.0",
25+
"browserify": "^3.38.0",
26+
"tape": "^2.12.2"
2527
},
2628
"licenses": [
2729
{
@@ -30,6 +32,6 @@
3032
}
3133
],
3234
"scripts": {
33-
"test": "tap --stderr --tap ./test"
35+
"test": "beefy test/test.js"
3436
}
3537
}

test/test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var xhr = require('../')
2+
var test = require('tape')
3+
4+
test('constructs and calls callback without throwing', function(t) {
5+
t.plan(1)
6+
xhr({}, function (err, resp, body) {
7+
t.ok(true, 'got here')
8+
})
9+
})
10+
11+
test('can GET current page', function(t) {
12+
t.plan(1)
13+
xhr({
14+
headers: {accept: "text/html"},
15+
uri: window.location.href,
16+
}, function (err, resp, body) {
17+
t.false(err, 'no err')
18+
})
19+
})
20+

0 commit comments

Comments
 (0)