From 7e36d810ac46243a8c5c5f7c823a82b7186abfbd Mon Sep 17 00:00:00 2001 From: anyueling Date: Mon, 18 Jul 2022 16:20:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?API=20MOCK=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: anyueling --- .../extend/systemplugin/napi/ohos_request.js | 269 ++++++++++++++++-- 1 file changed, 244 insertions(+), 25 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_request.js b/runtime/main/extend/systemplugin/napi/ohos_request.js index f82bdcc6..2f8ea44f 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_request.js +++ b/runtime/main/extend/systemplugin/napi/ohos_request.js @@ -13,38 +13,257 @@ * limitations under the License. */ -import { hasComplete } from "../utils" +import { paramMock } from "../utils" export function mockRequest() { - const uploadResponseMock = { - code: "[PC Preview]: unknow code", + const downloadConfigMock = { + url: "[PC Preview]: unknow uri", + herder: "[PC Preview]: unknow herder", + enableMetered: "[PC Preview]: unknow enableMetered", + enableRoaming: "[PC Preview]: unknow enableRoaming", + description: "[PC Preview]: unknow description", + networkType: "[PC Preview]: unknow networkType", + filePath: "[PC Preview]: unknow filePath", + title: "[PC Preview]: unknow title", + }; + + const downloadInfoMock = { + description: "[PC Preview]: unknow description", + downloadedBytes: "[PC Preview]: unknow downloadedBytes", + downloadId: "[PC Preview]: unknow downloadId", + failedReason: "[PC Preview]: unknow failedReason", + fileName: "[PC Preview]: unknow fileName", + filePath: "[PC Preview]: unknow filePath", + pausedReason: "[PC Preview]: unknow pausedReason", + status: "[PC Preview]: unknow status", + targetURI: "[PC Preview]: unknow targetURI", + downloadTitle: "[PC Preview]: unknow downloadTitle", + downloadTotalBytes: "[PC Preview]: unknow downloadTotalBytes", + }; + + const DownloadTask = { + on: function (...args) { + console.warn("AYL.downloadTask.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'progress') { + const receivedSize = "[PC Preview]: unknow receivedSize" + const totalSize = "[PC Preview]: unknow totalSize" + args[len - 1].call(this, receivedSize, totalSize) + } else if (args[0] == 'complete' | 'pause' | 'remove') { + args[len - 1].call(this) + } else if (args[0] == 'fail') { + const err = "[PC Preview]: unknow err" + args[len - 1].call(this, err) + } + } + }, + + off: function (...args) { + console.warn("AYL.downloadTask.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'progress') { + const receivedSize = "[PC Preview]: unknow receivedSize" + const totalSize = "[PC Preview]: unknow totalSize" + args[len - 1].call(this, receivedSize, totalSize) + } else if (args[0] == 'complete' | 'pause' | 'remove') { + args[len - 1].call(this) + } else if (args[0] == 'fail') { + const err = "[PC Preview]: unknow err" + args[len - 1].call(this, err) + } + } else { + if (args[0] == 'complete' | 'pause' | 'remove') { + args[len - 1].call(this) + } else if (args[0] == 'fail') { + const err = "[PC Preview]: unknow err" + args[len - 1].call(this, err) + } + } + }, + + remove: function (...args) { + console.warn("AYL.downloadTask.remove interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }) + } + }, + + pause: function (...args) { + console.warn("AYL.downloadTask.pause interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + + resume: function (...args) { + console.warn("AYL.downloadTask.resume interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock) + } else { + return new Promise((resolve) => { + resolve() + }) + } + }, + + query: function (...args) { + console.warn("AYL.downloadTask.query interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, downloadInfoMock) + } else { + return new Promise((resolve) => { + resolve(downloadInfoMock) + }) + } + }, + + queryMimeType: function (...args) { + console.warn("AYL.downloadTask.queryMimeType interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramStringMock) + }) + } + }, + }; + + const fileMock = { + filename: "[PC Preview]: unknow filename", + name: "[PC Preview]: unknow name", + uri: "[PC Preview]: unknow uri", + type: "[PC Preview]: unknow type", + }; + + const requestDataMock = { + name: "[PC Preview]: unknow name", + value: "[PC Preview]: unknow value", + }; + + const uploadConfigMock = { + url: "[PC Preview]: unknow uri", + herder: "[PC Preview]: unknow herder", + method: "[PC Preview]: unknow method", + files: "[PC Preview]: unknow files", data: "[PC Preview]: unknow data", - headers: "[PC Preview]: unknow headers" - } - const downloadResponse = { - token: "[PC Preview]: unknow token" - } - const onDownloadCompleteMock = { - uri: "[PC Preview]: unknow uri" - } + }; + + const UploadTask = { + on: function (...args) { + console.warn("AYL.uploadTask.on interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'progress') { + const uploadedSize = "[PC Preview]: unknow receivedSize" + const totalSize = "[PC Preview]: unknow totalSize" + args[len - 1].call(this, uploadedSize, totalSize) + } else if (args[0] == 'headerReceive') { + const header = "[PC Preview]: unknow header" + args[len - 1].call(this, header) + } + } + }, + + off: function (...args) { + console.warn("AYL.uploadTask.off interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device."); + const len = args.length + if (typeof args[len - 1] === 'function') { + if (args[0] == 'progress') { + const uploadedSize = "[PC Preview]: unknow receivedSize" + const totalSize = "[PC Preview]: unknow totalSize" + args[len - 1].call(this, uploadedSize, totalSize) + } else if (args[0] == 'headerReceive') { + const header = "[PC Preview]: unknow header" + args[len - 1].call(this, header) + } + } + }, + + remove: function (...args) { + console.warn("AYL.uploadTask.remove interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock) + } else { + return new Promise((resolve) => { + resolve(paramMock.paramBooleanMock) + }) + } + }, + }; + const request = { - upload: function (...args) { - console.warn("system.request.upload interface mocked in the Previewer. How this interface works on the" + - " Previewer may be different from that on a real device.") - args[0].success(uploadResponseMock) - hasComplete(args[0].complete) - }, + NETWORK_MOBILE: '[PC preview] unknow NETWORK_MOBILE', + NETWORK_WIFI: '[PC preview] unknow NETWORK_WIFI', + ERROR_CANNOT_RESUME: '[PC preview] unknow ERROR_CANNOT_RESUME', + ERROR_DEVICE_NOT_FOUND: '[PC preview] unknow ERROR_DEVICE_NOT_FOUND', + ERROR_FILE_ALREADY_EXISTS: '[PC preview] unknow ERROR_FILE_ALREADY_EXISTS', + ERROR_FILE_ERROR: '[PC preview] unknow ERROR_FILE_ERROR', + ERROR_HTTP_DATA_ERROR: '[PC preview] unknow ERROR_HTTP_DATA_ERROR', + ERROR_INSUFFICIENT_SPACE: '[PC preview] unknow ERROR_INSUFFICIENT_SPACE', + ERROR_TOO_MANY_REDIRECTS: '[PC preview] unknow ERROR_TOO_MANY_REDIRECTS', + ERROR_UNHANDLED_HTTP_CODE: '[PC preview] unknow ERROR_UNHANDLED_HTTP_CODE', + ERROR_UNKNOWN: '[PC preview] unknow ERROR_UNKNOWN', + PAUSED_QUEUED_FOR_WIFI: '[PC preview] unknow PAUSED_QUEUED_FOR_WIFI', + PAUSED_UNKNOWN: '[PC preview] unknow PAUSED_UNKNOWN', + PAUSED_WAITING_FOR_NETWORK: '[PC preview] unknow PAUSED_WAITING_FOR_NETWORK', + PAUSED_WAITING_TO_RETRY: '[PC preview] unknow PAUSED_WAITING_TO_RETRY', + SESSION_FAILED: '[PC preview] unknow SESSION_FAILED', + SESSION_PAUSED: '[PC preview] unknow SESSION_PAUSED', + SESSION_PENDING: '[PC preview] unknow SESSION_PENDING', + SESSION_RUNNING: '[PC preview] unknow SESSION_RUNNING', + SESSION_SUCCESSFUL: '[PC preview] unknow SESSION_SUCCESSFUL', + download: function (...args) { - console.warn("system.request.download interface mocked in the Previewer. How this interface works on the" + + console.warn("AYL.request.download interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") - args[0].success(downloadResponse) - hasComplete(args[0].complete) + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, DownloadTask) + } else { + return new Promise((resolve) => { + resolve(DownloadTask); + }) + } }, - onDownloadComplete: function (...args) { - console.warn("system.request.onDownloadComplete interface mocked in the Previewer. How this interface works on" + - " the Previewer may be different from that on a real device.") - args[0].success(onDownloadCompleteMock) - hasComplete(args[0].complete) + + upload: function (...args) { + console.warn("AYL.request.upload interface mocked in the Previewer. How this interface works on the" + + " Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, UploadTask) + } else { + return new Promise((resolve) => { + resolve(UploadTask) + }) + } } } return request From d5659f8fd3b9aa5a2e6cb95db2c4f9c6d69e3865 Mon Sep 17 00:00:00 2001 From: anyueling Date: Wed, 20 Jul 2022 10:05:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: anyueling --- .../extend/systemplugin/napi/ohos_request.js | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_request.js b/runtime/main/extend/systemplugin/napi/ohos_request.js index 2f8ea44f..6afa10cf 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_request.js +++ b/runtime/main/extend/systemplugin/napi/ohos_request.js @@ -16,7 +16,7 @@ import { paramMock } from "../utils" export function mockRequest() { - const downloadConfigMock = { + const DownloadConfig = { url: "[PC Preview]: unknow uri", herder: "[PC Preview]: unknow herder", enableMetered: "[PC Preview]: unknow enableMetered", @@ -27,7 +27,7 @@ export function mockRequest() { title: "[PC Preview]: unknow title", }; - const downloadInfoMock = { + const DownloadInfo = { description: "[PC Preview]: unknow description", downloadedBytes: "[PC Preview]: unknow downloadedBytes", downloadId: "[PC Preview]: unknow downloadId", @@ -43,7 +43,7 @@ export function mockRequest() { const DownloadTask = { on: function (...args) { - console.warn("AYL.downloadTask.on interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.on interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device."); const len = args.length if (typeof args[len - 1] === 'function') { @@ -61,7 +61,7 @@ export function mockRequest() { }, off: function (...args) { - console.warn("AYL.downloadTask.off interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.off interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device."); const len = args.length if (typeof args[len - 1] === 'function') { @@ -75,18 +75,11 @@ export function mockRequest() { const err = "[PC Preview]: unknow err" args[len - 1].call(this, err) } - } else { - if (args[0] == 'complete' | 'pause' | 'remove') { - args[len - 1].call(this) - } else if (args[0] == 'fail') { - const err = "[PC Preview]: unknow err" - args[len - 1].call(this, err) - } } }, remove: function (...args) { - console.warn("AYL.downloadTask.remove interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.remove interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -99,7 +92,7 @@ export function mockRequest() { }, pause: function (...args) { - console.warn("AYL.downloadTask.pause interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.pause interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -112,7 +105,7 @@ export function mockRequest() { }, resume: function (...args) { - console.warn("AYL.downloadTask.resume interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.resume interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -125,7 +118,7 @@ export function mockRequest() { }, query: function (...args) { - console.warn("AYL.downloadTask.query interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.query interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -138,7 +131,7 @@ export function mockRequest() { }, queryMimeType: function (...args) { - console.warn("AYL.downloadTask.queryMimeType interface mocked in the Previewer. How this interface works on the" + + console.warn("downloadTask.queryMimeType interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -151,29 +144,29 @@ export function mockRequest() { }, }; - const fileMock = { + const File = { filename: "[PC Preview]: unknow filename", name: "[PC Preview]: unknow name", uri: "[PC Preview]: unknow uri", type: "[PC Preview]: unknow type", }; - const requestDataMock = { + const RequestData = { name: "[PC Preview]: unknow name", value: "[PC Preview]: unknow value", }; - const uploadConfigMock = { + const UploadConfig = { url: "[PC Preview]: unknow uri", herder: "[PC Preview]: unknow herder", method: "[PC Preview]: unknow method", - files: "[PC Preview]: unknow files", - data: "[PC Preview]: unknow data", + files: [File], + data: [RequestData], }; const UploadTask = { on: function (...args) { - console.warn("AYL.uploadTask.on interface mocked in the Previewer. How this interface works on the" + + console.warn("uploadTask.on interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device."); const len = args.length if (typeof args[len - 1] === 'function') { @@ -189,7 +182,7 @@ export function mockRequest() { }, off: function (...args) { - console.warn("AYL.uploadTask.off interface mocked in the Previewer. How this interface works on the" + + console.warn("uploadTask.off interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device."); const len = args.length if (typeof args[len - 1] === 'function') { @@ -205,7 +198,7 @@ export function mockRequest() { }, remove: function (...args) { - console.warn("AYL.uploadTask.remove interface mocked in the Previewer. How this interface works on the" + + console.warn("uploadTask.remove interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -241,7 +234,7 @@ export function mockRequest() { SESSION_SUCCESSFUL: '[PC preview] unknow SESSION_SUCCESSFUL', download: function (...args) { - console.warn("AYL.request.download interface mocked in the Previewer. How this interface works on the" + + console.warn("request.download interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { @@ -254,7 +247,7 @@ export function mockRequest() { }, upload: function (...args) { - console.warn("AYL.request.upload interface mocked in the Previewer. How this interface works on the" + + console.warn("request.upload interface mocked in the Previewer. How this interface works on the" + " Previewer may be different from that on a real device.") const len = args.length if (typeof args[len - 1] === 'function') { From 5709a9aac624e773492076701c1c0a3fb23db16e Mon Sep 17 00:00:00 2001 From: anyueling Date: Mon, 25 Jul 2022 14:50:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: anyueling --- .../extend/systemplugin/napi/ohos_request.js | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/runtime/main/extend/systemplugin/napi/ohos_request.js b/runtime/main/extend/systemplugin/napi/ohos_request.js index 6afa10cf..c6bd6927 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_request.js +++ b/runtime/main/extend/systemplugin/napi/ohos_request.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,28 +17,28 @@ import { paramMock } from "../utils" export function mockRequest() { const DownloadConfig = { - url: "[PC Preview]: unknow uri", - herder: "[PC Preview]: unknow herder", - enableMetered: "[PC Preview]: unknow enableMetered", - enableRoaming: "[PC Preview]: unknow enableRoaming", - description: "[PC Preview]: unknow description", - networkType: "[PC Preview]: unknow networkType", - filePath: "[PC Preview]: unknow filePath", - title: "[PC Preview]: unknow title", + url: "[PC Preview] unknow uri", + herder: "[PC Preview] unknow herder", + enableMetered: "[PC Preview] unknow enableMetered", + enableRoaming: "[PC Preview] unknow enableRoaming", + description: "[PC Preview] unknow description", + networkType: "[PC Preview] unknow networkType", + filePath: "[PC Preview] unknow filePath", + title: "[PC Preview] unknow title", }; const DownloadInfo = { - description: "[PC Preview]: unknow description", - downloadedBytes: "[PC Preview]: unknow downloadedBytes", - downloadId: "[PC Preview]: unknow downloadId", - failedReason: "[PC Preview]: unknow failedReason", - fileName: "[PC Preview]: unknow fileName", - filePath: "[PC Preview]: unknow filePath", - pausedReason: "[PC Preview]: unknow pausedReason", - status: "[PC Preview]: unknow status", - targetURI: "[PC Preview]: unknow targetURI", - downloadTitle: "[PC Preview]: unknow downloadTitle", - downloadTotalBytes: "[PC Preview]: unknow downloadTotalBytes", + description: "[PC Preview] unknow description", + downloadedBytes: "[PC Preview] unknow downloadedBytes", + downloadId: "[PC Preview] unknow downloadId", + failedReason: "[PC Preview] unknow failedReason", + fileName: "[PC Preview] unknow fileName", + filePath: "[PC Preview] unknow filePath", + pausedReason: "[PC Preview] unknow pausedReason", + status: "[PC Preview] unknow status", + targetURI: "[PC Preview] unknow targetURI", + downloadTitle: "[PC Preview] unknow downloadTitle", + downloadTotalBytes: "[PC Preview] unknow downloadTotalBytes", }; const DownloadTask = { @@ -48,13 +48,13 @@ export function mockRequest() { const len = args.length if (typeof args[len - 1] === 'function') { if (args[0] == 'progress') { - const receivedSize = "[PC Preview]: unknow receivedSize" - const totalSize = "[PC Preview]: unknow totalSize" + const receivedSize = "[PC Preview] unknow receivedSize" + const totalSize = "[PC Preview] unknow totalSize" args[len - 1].call(this, receivedSize, totalSize) } else if (args[0] == 'complete' | 'pause' | 'remove') { args[len - 1].call(this) } else if (args[0] == 'fail') { - const err = "[PC Preview]: unknow err" + const err = "[PC Preview] unknow err" args[len - 1].call(this, err) } } @@ -66,8 +66,8 @@ export function mockRequest() { const len = args.length if (typeof args[len - 1] === 'function') { if (args[0] == 'progress') { - const receivedSize = "[PC Preview]: unknow receivedSize" - const totalSize = "[PC Preview]: unknow totalSize" + const receivedSize = "[PC Preview] unknow receivedSize" + const totalSize = "[PC Preview] unknow totalSize" args[len - 1].call(this, receivedSize, totalSize) } else if (args[0] == 'complete' | 'pause' | 'remove') { args[len - 1].call(this) @@ -145,21 +145,21 @@ export function mockRequest() { }; const File = { - filename: "[PC Preview]: unknow filename", - name: "[PC Preview]: unknow name", - uri: "[PC Preview]: unknow uri", - type: "[PC Preview]: unknow type", + filename: "[PC Preview] unknow filename", + name: "[PC Preview] unknow name", + uri: "[PC Preview] unknow uri", + type: "[PC Preview] unknow type", }; const RequestData = { - name: "[PC Preview]: unknow name", - value: "[PC Preview]: unknow value", + name: "[PC Preview] unknow name", + value: "[PC Preview] unknow value", }; const UploadConfig = { - url: "[PC Preview]: unknow uri", - herder: "[PC Preview]: unknow herder", - method: "[PC Preview]: unknow method", + url: "[PC Preview] unknow uri", + herder: "[PC Preview] unknow herder", + method: "[PC Preview] unknow method", files: [File], data: [RequestData], }; @@ -171,11 +171,11 @@ export function mockRequest() { const len = args.length if (typeof args[len - 1] === 'function') { if (args[0] == 'progress') { - const uploadedSize = "[PC Preview]: unknow receivedSize" - const totalSize = "[PC Preview]: unknow totalSize" + const uploadedSize = "[PC Preview] unknow receivedSize" + const totalSize = "[PC Preview] unknow totalSize" args[len - 1].call(this, uploadedSize, totalSize) } else if (args[0] == 'headerReceive') { - const header = "[PC Preview]: unknow header" + const header = "[PC Preview] unknow header" args[len - 1].call(this, header) } } @@ -187,11 +187,11 @@ export function mockRequest() { const len = args.length if (typeof args[len - 1] === 'function') { if (args[0] == 'progress') { - const uploadedSize = "[PC Preview]: unknow receivedSize" - const totalSize = "[PC Preview]: unknow totalSize" + const uploadedSize = "[PC Preview] unknow receivedSize" + const totalSize = "[PC Preview] unknow totalSize" args[len - 1].call(this, uploadedSize, totalSize) } else if (args[0] == 'headerReceive') { - const header = "[PC Preview]: unknow header" + const header = "[PC Preview] unknow header" args[len - 1].call(this, header) } }