Skip to content

Commit

Permalink
fix(retry): remove outdated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi committed Dec 11, 2023
1 parent 192aa60 commit 803bb29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions tests/hcaptcha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ReactTestUtils, { act } from "react-dom/test-utils";

import { describe, jest, it } from "@jest/globals";

import {getMockedHcaptcha, MOCK_EKEY, MOCK_TOKEN, MOCK_WIDGET_ID} from "./hcaptcha.mock";
import { getMockedHcaptcha, MOCK_EKEY, MOCK_TOKEN, MOCK_WIDGET_ID } from "./hcaptcha.mock";

let HCaptcha;

Expand Down Expand Up @@ -503,27 +503,6 @@ describe("hCaptcha", () => {
expect(script.src).toContain("custom=true");
});

it("emits error when script is failed", async () => {
const onError = jest.fn();

instance = ReactTestUtils.renderIntoDocument(<HCaptcha
onError={onError}
sitekey={TEST_PROPS.sitekey}
sentry={false}
/>);

const script = document.querySelector("head > script");
expect(onError.mock.calls.length).toBe(0);

script.onerror(new Error('loading failed'));

// simulate microtask
await Promise.reject().catch(() => null)

expect(onError.mock.calls.length).toBe(1);
expect(onError.mock.calls[0][0].message).toEqual("script-error");
});

it("should have async set by default", () => {
instance = ReactTestUtils.renderIntoDocument(<HCaptcha
sitekey={TEST_PROPS.sitekey}
Expand Down

0 comments on commit 803bb29

Please sign in to comment.