mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
Fix database closed multiple times.
utt part support Ctrl + C
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import { assertEquals } from "std/testing/asserts.ts";
|
||||
import { check_running } from "./pid_check.ts";
|
||||
import { asyncFilter, promiseState, PromiseStatus, sleep } from "./utils.ts";
|
||||
import {
|
||||
asyncFilter,
|
||||
asyncForEach,
|
||||
promiseState,
|
||||
PromiseStatus,
|
||||
sleep,
|
||||
} from "./utils.ts";
|
||||
|
||||
Deno.test("promiseState_test", async () => {
|
||||
const p1 = new Promise((res) => setTimeout(() => res(100), 100));
|
||||
@@ -42,3 +48,12 @@ Deno.test("asyncFilter_test", async () => {
|
||||
assertEquals(v, e);
|
||||
await Promise.allSettled(e);
|
||||
});
|
||||
|
||||
Deno.test("asyncForEach", async () => {
|
||||
const e = [new Promise<number>((res) => setTimeout(() => res(100), 100))];
|
||||
const t = { test: 2 };
|
||||
await asyncForEach(e, async function (e) {
|
||||
assertEquals(this, t);
|
||||
await e;
|
||||
}, t);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user