Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(loader): bump loader version #213

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hcaptcha/react-hcaptcha",
"version": "1.9.2",
"version": "1.9.3",
"types": "types/index.d.ts",
"main": "dist/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -59,6 +59,6 @@
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"@hcaptcha/loader": "^1.0.10"
"@hcaptcha/loader": "^1.1.2"
}
}
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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brdlyptrs can you confirm that this microtask is expected to not work after latest @hcaptcha/loader update (as now it returns resolved promise or error instead of promise)


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
Loading