Skip to content

Commit 6db6e6b

Browse files
author
jarvisjiang
committed
fill test cases
1 parent 839a0d1 commit 6db6e6b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/fetch.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ Deno.test('fetch', async (t) => {
132132
assert((res.unwrapErr() as Error).message.includes(`Response is invalid json`));
133133
});
134134

135+
await t.step('Ignore timeout when success', async () => {
136+
const res = await fetchT(mockSingle, {
137+
timeout: 10000,
138+
});
139+
140+
assert(res.isOk());
141+
// Leak risk
142+
res.unwrap().body?.cancel();
143+
});
144+
135145
await t.step('Abort fetch by default', async () => {
136146
const fetchTask = fetchT(mockSingle, {
137147
abortable: true,
@@ -140,7 +150,7 @@ Deno.test('fetch', async (t) => {
140150

141151
setTimeout(() => {
142152
fetchTask.abort();
143-
}, 0);
153+
}, 100);
144154

145155
const res = await fetchTask.response;
146156
assert((res.unwrapErr() as Error).name === ABORT_ERROR);

0 commit comments

Comments
 (0)