From d6ef28d4caf347c7c42454a98359e1742e87a550 Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Sat, 7 Oct 2023 12:25:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=AF=E3=82=A8=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=81=AE=E6=94=B9?= =?UTF-8?q?=E5=96=84=20(#11978)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update utils.ts * no async executer --- packages/backend/test/utils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/backend/test/utils.ts b/packages/backend/test/utils.ts index 121c4711d..738635dae 100644 --- a/packages/backend/test/utils.ts +++ b/packages/backend/test/utils.ts @@ -301,12 +301,14 @@ export const uploadFile = async (user?: UserToken, { path, name, blob }: UploadO }; export const uploadUrl = async (user: UserToken, url: string) => { - let file: any; + let resolve: unknown; + const file = new Promise(ok => resolve = ok); const marker = Math.random().toString(); const ws = await connectStream(user, 'main', (msg) => { if (msg.type === 'urlUploadFinished' && msg.body.marker === marker) { - file = msg.body.file; + ws.close(); + resolve(msg.body.file); } }); @@ -316,9 +318,6 @@ export const uploadUrl = async (user: UserToken, url: string) => { force: true, }, user); - await sleep(7000); - ws.close(); - return file; };