Skip to content

Commit

Permalink
tests: wait for interval stoped
Browse files Browse the repository at this point in the history
  • Loading branch information
shevernitskiy committed Dec 14, 2024
1 parent 7147ca1 commit ce4047f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/amo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export class Amo extends EventEmitter<WebhookEventMap> {

return new Response("OK", { status: 200 });
} catch (err) {
throw new WebhookError(err);
throw new WebhookError((err as Error).message);
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/rest-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class RestClient {
return res.body ? (await res.json()) as T : null as T;
} catch (err) {
if (this.options?.on_error) {
this.options.on_error(err);
this.options.on_error(err as Error | AuthError | ApiError | NoContentError | HttpError);
return null as T;
} else {
throw err;
Expand Down
12 changes: 6 additions & 6 deletions tests/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Deno.test("should return HttpError", async () => {
assertInstanceOf(err, HttpError);
}

await sleep(200);
await sleep(1200);
});

Deno.test("should return NoContentError", async () => {
Expand All @@ -53,7 +53,7 @@ Deno.test("should return NoContentError", async () => {
assertInstanceOf(err, NoContentError);
}

await sleep(200);
await sleep(1200);
});

Deno.test("should return ApiError", async () => {
Expand Down Expand Up @@ -86,7 +86,7 @@ Deno.test("should return ApiError", async () => {
});
}

await sleep(200);
await sleep(1200);
});

Deno.test("should return WebhookError", async () => {
Expand All @@ -101,7 +101,7 @@ Deno.test("should return WebhookError", async () => {
assertInstanceOf(err, WebhookError);
}

await sleep(200);
await sleep(1200);
});

Deno.test("should return AuthError", async () => {
Expand All @@ -119,7 +119,7 @@ Deno.test("should return AuthError", async () => {
assertInstanceOf(err, AuthError);
}

await sleep(200);
await sleep(1200);
});

Deno.test("should return AuthError to error handler", async () => {
Expand All @@ -134,5 +134,5 @@ Deno.test("should return AuthError to error handler", async () => {

await amo.lead.getLeadById(69);

await sleep(200);
await sleep(1200);
});
76 changes: 0 additions & 76 deletions tests/webhook.test.ts

This file was deleted.

0 comments on commit ce4047f

Please sign in to comment.