{"id":13726682,"url":"https://github.com/beizhedenglong/reason-hooks-testing-library","last_synced_at":"2025-04-13T12:13:41.847Z","repository":{"id":57348969,"uuid":"187045775","full_name":"beizhedenglong/reason-hooks-testing-library","owner":"beizhedenglong","description":"ReasonML bindings for react-hooks-testing-library","archived":false,"fork":false,"pushed_at":"2020-09-13T12:59:10.000Z","size":80,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T12:13:29.594Z","etag":null,"topics":["react-hooks","reason-react","reasonml","reasonml-bindings"],"latest_commit_sha":null,"homepage":"","language":"Reason","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beizhedenglong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-16T14:37:41.000Z","updated_at":"2024-06-04T21:29:28.000Z","dependencies_parsed_at":"2022-09-02T13:23:13.271Z","dependency_job_id":null,"html_url":"https://github.com/beizhedenglong/reason-hooks-testing-library","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beizhedenglong%2Freason-hooks-testing-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beizhedenglong%2Freason-hooks-testing-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beizhedenglong%2Freason-hooks-testing-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beizhedenglong%2Freason-hooks-testing-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beizhedenglong","download_url":"https://codeload.github.com/beizhedenglong/reason-hooks-testing-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710448,"owners_count":21149191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-hooks","reason-react","reasonml","reasonml-bindings"],"created_at":"2024-08-03T01:03:16.585Z","updated_at":"2025-04-13T12:13:41.817Z","avatar_url":"https://github.com/beizhedenglong.png","language":"Reason","funding_links":[],"categories":["Reason"],"sub_categories":[],"readme":"# reason-hooks-testing-library\n\nReason bindings for [`react-hooks-testing-library`](https://github.com/mpeyper/react-hooks-testing-library).\n\n## Installation\n`npm install --save-dev reason-hooks-testing-library`\n\nThen add `reason-hooks-testing-library` to `bs-dev-dependencies` in your `bsconfig.json`:\n\n```json\n{\n  \"bs-dev-dependencies\": [\"@glennsl/bs-jest\", \"reason-hooks-testing-library\"]\n}\n```\n\n## Example\n\n```reason\n\nopen Jest;\nopen Expect;\nopen ReasonHooksTestingLibrary.Testing;\n\ntype counterType = {\n  counter: int,\n  set: (int =\u003e int) =\u003e unit,\n};\nlet useCounter = initial =\u003e {\n  let (counter, set) = React.useState(() =\u003e initial);\n  {counter, set};\n};\n\ndescribe(\"useCounter\", () =\u003e {\n  open Result;\n  let container = renderHook(() =\u003e useCounter(0), ());\n  test(\"counter is 0\", () =\u003e\n    expect(container-\u003eresult-\u003ecurrent.counter) |\u003e toEqual(0)\n  );\n  test(\"counter is 1\", () =\u003e {\n    act(() =\u003e container-\u003eresult-\u003ecurrent.set(prev =\u003e prev + 1));\n    expect(container-\u003eresult-\u003ecurrent.counter) |\u003e toEqual(1);\n  });\n  test(\"counter is 2\", () =\u003e {\n    act(() =\u003e container-\u003eresult-\u003ecurrent.set(prev =\u003e prev + 1));\n    expect(container-\u003eresult-\u003ecurrent.counter) |\u003e toEqual(2);\n  });\n});\n\n```\n[More examples](https://github.com/beizhedenglong/reason-hooks-testing-library/tree/master/__tests__)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeizhedenglong%2Freason-hooks-testing-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeizhedenglong%2Freason-hooks-testing-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeizhedenglong%2Freason-hooks-testing-library/lists"}