Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lisposter committed Jul 30, 2014
1 parent cfbe56b commit c6ecb4c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test-cov:
./node_modules/.bin/_mocha \
-- -u exports \
--require should \
--timeout 10000 \
$(TESTS) \
--bail

Expand Down
3 changes: 0 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ function transEndpoint(endpoint) {
switch((endpoint ? endpoint : '').toLowerCase()) {
case 'ctcc':
return 'v1.api.upyun.com';
break;
case 'cucc':
return 'v2.api.upyun.com';
break;
case 'cmcc':
return 'v3.api.upyun.com';
break;
default:
return 'v0.api.upyun.com';
}
Expand Down
16 changes: 16 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,25 @@ describe('utils', function() {
})

describe('.setEndpoint(ep)', function() {
it('should set endpoint', function() {
upyun.setEndpoint();
upyun.getConf('endpoint').should.be.exactly('v0.api.upyun.com');
})

it('should set endpoint', function() {
upyun.setEndpoint('ctcc');
upyun.getConf('endpoint').should.be.exactly('v1.api.upyun.com');
})

it('should set endpoint', function() {
upyun.setEndpoint('cucc');
upyun.getConf('endpoint').should.be.exactly('v2.api.upyun.com');
})

it('should set endpoint', function() {
upyun.setEndpoint('cmcc');
upyun.getConf('endpoint').should.be.exactly('v3.api.upyun.com');
})
})

})

0 comments on commit c6ecb4c

Please sign in to comment.