Skip to content

Commit

Permalink
fix: 补充单测 (merge request !35)
Browse files Browse the repository at this point in the history
Squash merge branch 'dev/ut' into 'master'
fix: 补充单测
  • Loading branch information
livehigh committed May 8, 2024
1 parent 5f22059 commit 035f12e
Show file tree
Hide file tree
Showing 7 changed files with 833 additions and 351 deletions.
9 changes: 0 additions & 9 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -8738,10 +8738,6 @@ var util = __webpack_require__(/*! ./util */ "./src/util.js");
* @param {Function} callback 回调函数,必须
*/
function getService(params, callback) {
if (typeof params === 'function') {
callback = params;
params = {};
}
var protocol = this.options.Protocol || (util.isBrowser && (typeof location === "undefined" ? "undefined" : _typeof(location)) === 'object' && location.protocol === 'http:' ? 'http:' : 'https:');
var domain = this.options.ServiceDomain;
var appId = params.AppId || this.options.appId;
Expand Down Expand Up @@ -13140,10 +13136,6 @@ var initTask = function initTask(cos) {
var waiting = task && task.state === 'waiting';
var running = task && (task.state === 'checking' || task.state === 'uploading');
if (switchToState === 'canceled' && task.state !== 'canceled' || switchToState === 'paused' && waiting || switchToState === 'paused' && running) {
if (switchToState === 'paused' && task.params.Body && typeof task.params.Body.pipe === 'function') {
console.error('stream not support pause');
return;
}
task.state = switchToState;
cos.emit('inner-kill-task', {
TaskId: id,
Expand Down Expand Up @@ -13614,7 +13606,6 @@ var Tracker = /*#__PURE__*/function () {
if (!this.beacon && !this.clsReporter) return;
this.formatResult(err, data);
var formattedParams = formatParams(this.params);
console.log(formattedParams);
if (this.beacon) {
this.sendEventsToBeacon(formattedParams);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2047,8 +2047,9 @@ declare class COS {

// 实例方法
/** 获取用户的 bucket 列表 @see https://cloud.tencent.com/document/product/436/8291 */
getService(callback: (err: COS.CosError, data: COS.GetServiceResult) => void): void;
getService(params: COS.GetServiceParams, callback: (err: COS.CosError, data: COS.GetServiceResult) => void): void;
getService(params: COS.GetServiceParams): Promise<COS.GetServiceResult>;
getService(params?: COS.GetServiceParams): Promise<COS.GetServiceResult>;

/** 创建 Bucket,并初始化访问权限 @see https://cloud.tencent.com/document/product/436/7738 */
putBucket(params: COS.PutBucketParams, callback: (err: COS.CosError, data: COS.PutBucketResult) => void): void;
Expand Down Expand Up @@ -2559,10 +2560,6 @@ declare class COS {
/** 判断上传队列是否有未完成的任务 */
isUploadRunning(): boolean;

/** 分片复制文件 */
request(params: COS.RequestParams, callback: (err: COS.CosError, data: COS.RequestResult) => void): void;
request(params: COS.RequestParams): Promise<COS.RequestResult>;

/** 获取文件下载链接 @see https://cloud.tencent.com/document/product/436/35651 */
getObjectUrl(
params: COS.GetObjectUrlParams,
Expand Down
4 changes: 0 additions & 4 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ var util = require('./util');
* @param {Function} callback 回调函数,必须
*/
function getService(params, callback) {
if (typeof params === 'function') {
callback = params;
params = {};
}
var protocol =
this.options.Protocol ||
(util.isBrowser && typeof location === 'object' && location.protocol === 'http:' ? 'http:' : 'https:');
Expand Down
4 changes: 0 additions & 4 deletions src/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ var initTask = function (cos) {
(switchToState === 'paused' && waiting) ||
(switchToState === 'paused' && running)
) {
if (switchToState === 'paused' && task.params.Body && typeof task.params.Body.pipe === 'function') {
console.error('stream not support pause');
return;
}
task.state = switchToState;
cos.emit('inner-kill-task', { TaskId: id, toState: switchToState });
try {
Expand Down
1 change: 0 additions & 1 deletion src/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ class Tracker {
if (!this.beacon && !this.clsReporter) return;
this.formatResult(err, data);
const formattedParams = formatParams(this.params);
console.log(formattedParams);
if (this.beacon) {
this.sendEventsToBeacon(formattedParams);
}
Expand Down
Loading

0 comments on commit 035f12e

Please sign in to comment.