Skip to content

Refactor some code & add some test cases #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 18, 2019
Merged

Conversation

helloyou2012
Copy link
Contributor

@helloyou2012 helloyou2012 commented Oct 16, 2019

  1. compute block count with Math.ceil
  2. add putStream test
  3. add cancel putBucketQuota test
  4. cover with nyc
  5. useCache refactor

@helloyou2012 helloyou2012 changed the title compute block count with Math.ceil & some test cases Refactor some code & add some test cases Oct 17, 2019
Copy link

@JemyCheung JemyCheung left a comment

Choose a reason for hiding this comment

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

测试有一处没过,可以修改一下
部分改动缩小代码量,通用型更强

test/rs.test.js Outdated
it('test privateDownloadUrl', function (done) {
var key = 'qiniu.mp4';
var url = bucketManager.privateDownloadUrl('http://' + domain, key, 20);
should.equal(url, 'http://' + domain + '/qiniu.mp4?e=20&token=ExAdnmHq914NVa8addkXooUvXSyzGPHYzxzJwDnN:vZRvLfuw4U9vJzweTVgPdPFIY-g=');

Choose a reason for hiding this comment

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

建议代码生成鉴权downloadUrl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里改成了下载请求

should.not.exist(err);
console.log(JSON.stringify(respBody) + '\n');
console.log(JSON.stringify(respInfo));
respBody.should.have.keys('item');

Choose a reason for hiding this comment

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

接口没问题,test过不了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个接口不应该返回列表么?我测试时返回的是单个对象

Choose a reason for hiding this comment

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

数据问题,暂时不关注,可以看看examples/rs_listv2.js的注释

@@ -134,3 +135,32 @@ exports.isQiniuCallback = function (mac, requestURI, reqBody, callbackAuth) {
var auth = exports.generateAccessToken(mac, requestURI, reqBody);
return auth === callbackAuth;
};

exports.prepareZone = function (ctx, accessKey, bucket, callback) {

Choose a reason for hiding this comment

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

Best pr

@bachue bachue merged commit ccb756e into qiniu:master Oct 18, 2019
@bachue
Copy link
Contributor

bachue commented Oct 18, 2019

Thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants