Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Update dependencies & travis #4

Merged
merged 5 commits into from May 3, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
@@ -1,5 +1,7 @@
language: node_js
sudo: false
node_js:
- "0.11"
- "node"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better change to 4, 5, 6, others LGTM

script: "make test-travis"
after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -22,15 +22,15 @@
},
"license": "MIT",
"dependencies": {
"urllib": "~2.5.0",
"utility": "~1.6.0"
"urllib": "~2.9.0",
"utility": "~1.7.1"
},
"devDependencies": {
"autod": "1",
"autod": "2",
"iconv-lite": "~0.4.13",
"istanbul": "~0.4.1",
"mocha": "~2.3.4",
"should": "~7.1.1"
"istanbul": "~0.4.3",
"mocha": "~2.4.5",
"should": "~8.3.1"
},
"engine": {
"node": ">=0.11.13"
Expand Down
11 changes: 9 additions & 2 deletions test/index.test.js
Expand Up @@ -17,23 +17,28 @@ var fs = require('fs');
describe('urllib-sync', function () {
describe('request()', function () {
it('should request gbk ok', function () {
this.timeout(4000);
var res = urllib.request('http://www.taobao.com/go/rgn/tmall/header/2014/sub-nav.php');
var data = iconv.decode(res.data, 'gbk');
data.should.containEql('天猫');
res.status.should.equal(200);
});

it('should request text ok', function () {
this.timeout(30000);
var res = urllib.request('http://npm.taobao.org', {
dataType: 'text'
dataType: 'text',
timeout: 30000
});
res.data.should.containEql('淘宝 NPM 镜像');
res.status.should.equal(200);
});

it('should request json ok', function () {
this.timeout(30000);
var res = urllib.request('http://registry.npm.taobao.org/koa', {
dataType: 'json'
dataType: 'json',
timeout: 30000
});
res.data.name.should.equal('koa');
res.status.should.equal(200);
Expand All @@ -52,6 +57,7 @@ describe('urllib-sync', function () {
});

it('should writeFile ok', function () {
this.timeout(4000);
var res = urllib.request('http://www.taobao.com/go/rgn/tmall/header/2014/sub-nav.php', {
writeFile: './tmp'
});
Expand All @@ -62,6 +68,7 @@ describe('urllib-sync', function () {
});

it('should not write file when status 302', function () {
this.timeout(4000);
var res = urllib.request('http://www.taobao.com/not/exist/file/path', {
writeFile: './404file'
});
Expand Down