Skip to content

Commit

Permalink
バックエンドのテストの改善 (#11978)
Browse files Browse the repository at this point in the history
* Update utils.ts

* no async executer
  • Loading branch information
FineArchs authored Oct 7, 2023
1 parent 93bd341 commit d6ef28d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/backend/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand All @@ -316,9 +318,6 @@ export const uploadUrl = async (user: UserToken, url: string) => {
force: true,
}, user);

await sleep(7000);
ws.close();

return file;
};

Expand Down

0 comments on commit d6ef28d

Please sign in to comment.