From fdae804cf16afec0c6a769be2b01bf08cb12c226 Mon Sep 17 00:00:00 2001 From: taohebin Date: Wed, 29 May 2024 17:53:02 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=20=E4=B8=8B=E8=BD=BD=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E7=9A=84=E5=9C=B0=E5=9D=80=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/download-file/download-file.test.js | 8 +++++++- pages/API/download-file/download-file.uvue | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pages/API/download-file/download-file.test.js b/pages/API/download-file/download-file.test.js index fe16cece..eb83f41c 100644 --- a/pages/API/download-file/download-file.test.js +++ b/pages/API/download-file/download-file.test.js @@ -21,7 +21,13 @@ describe('ExtApi-DownloadFile', () => { it('Check ', async () => { expect(res).toBe(true); }); - + + it('Check Special characters Url download file', async () => { + res = await page.callMethod('jest_special_characters_download') + await page.waitFor(2000); + res = await page.data('jest_result'); + expect(res).toBe(true) + }); if (!process.env.uniTestPlatformInfo.startsWith('web')) { it('Check uni.env', async () => { diff --git a/pages/API/download-file/download-file.uvue b/pages/API/download-file/download-file.uvue index 3e2d7fdc..35cef628 100644 --- a/pages/API/download-file/download-file.uvue +++ b/pages/API/download-file/download-file.uvue @@ -149,6 +149,18 @@ } } as CommonOptions) // #endif + }, + jest_special_characters_download(){ + uni.downloadFile({ + url: "https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/1789834995055525889-你好%23你好.png", + success: (res: DownloadFileSuccess) => { + this.jest_result = true; + console.log("res :", res); + }, + fail: () => { + this.jest_result = false; + } + }); } } } -- GitLab