Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Aug 14, 2023
1 parent d274986 commit 25c581f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/logic/download-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ describe("download-manager", () => {

test("should forcibly stopped while downloading", async () => {
let counter = 0
;(fetch as ReturnType<typeof vi.fn>).mockReset()
;(fetch as ReturnType<typeof vi.fn>).mockImplementation(async (url) => {
// await sleep(500)
if (counter++ > 5) return Promise.reject(new Error("time_out"))
Expand Down Expand Up @@ -221,6 +222,7 @@ describe("download-manager", () => {

test("should continue while downloading", async () => {
let counter = 0
;(fetch as ReturnType<typeof vi.fn>).mockReset()
;(fetch as ReturnType<typeof vi.fn>).mockImplementation(async (url) => {
// await sleep(500)
if (counter++ > 5) return Promise.reject(new Error("time_out"))
Expand Down
3 changes: 1 addition & 2 deletions src/logic/download-manager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable functional/no-throw-statement */
/* eslint-disable camelcase */
import hashSum from "hash-sum"
import { mapLimit } from "modern-async"

/*
.
Expand Down Expand Up @@ -71,7 +70,7 @@ async function downloadFiles(
downloading: Ref<boolean>,
onprogress: (cur: number, total: number, path: string) => void
): Promise<void> {
await mapLimit(
await someLimit(
sources,
async (src: string, index: number) => {
if (src.startsWith(PROTOCOL_OFFLINE)) return false
Expand Down

0 comments on commit 25c581f

Please sign in to comment.