{"id":21833151,"url":"https://github.com/rwstauner/cljc-test-async","last_synced_at":"2025-03-21T13:45:39.045Z","repository":{"id":57713880,"uuid":"411139479","full_name":"rwstauner/cljc-test-async","owner":"rwstauner","description":"Utilities for writing async tests for both clj and cljs (cljc).","archived":false,"fork":false,"pushed_at":"2021-11-06T17:14:09.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T10:11:59.487Z","etag":null,"topics":["async","clojure","clojurescript","testing"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwstauner.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-09-28T04:43:20.000Z","updated_at":"2023-06-10T17:32:49.000Z","dependencies_parsed_at":"2022-08-25T12:52:03.960Z","dependency_job_id":null,"html_url":"https://github.com/rwstauner/cljc-test-async","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fcljc-test-async","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fcljc-test-async/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fcljc-test-async/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwstauner%2Fcljc-test-async/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwstauner","download_url":"https://codeload.github.com/rwstauner/cljc-test-async/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244807452,"owners_count":20513644,"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":["async","clojure","clojurescript","testing"],"created_at":"2024-11-27T19:28:35.850Z","updated_at":"2025-03-21T13:45:38.998Z","avatar_url":"https://github.com/rwstauner.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# net.r4s6/test-async\n\nUtilities for writing async tests for both clj and cljs (cljc).\n\n## Usage\n\nIn `deps.edn`:\n\n```clojure\n{net.r4s6/test-async {:mvn/version \"0.2.0\"}}\n```\n\nIn your tests:\n\n```clojure\n(ns your-tests\n  (:require\n    [clojure.test :as t]\n    [net.r4s6.test-async :as a :include-macros true]))\n\n(t/deftest something\n  (a/async\n    done\n    (a/async-redefs\n      [some/var new-value]\n      reset-redefs\n      (pass (juxt reset-redefs done) to something async)))\n```\n\n## API\n\n### async\n\nWorks just like `cljs.test/async`\n\n```clojure\n(async\n  done\n  (do\n    ...\n    (done))\n```\n\nIn this example `done` is the name that the callback function\nwill be bound to in the body.\n\nNOTE: It should be called without arguments.\n\n### async-redefs\n\nLike `clojure.core/with-redefs` but instead of restoring defs at the end of the\nblock it defines a callback function that your block should call when finished\n(similar to the way `async` works) that will restore the vars.\n\n```clojure\n(async-redefs\n  [some-var new-value]\n  reset-redefs\n  (do\n    ...\n    (reset-redefs))\n```\n\nIn this example `reset-redefs` is the name that the callback function\nwill be bound to in the body.\n\nNOTE: It should be called without arguments.\n\n### with-timeout\n\nConfigure the timeout for async tests (default is 10000ms).\n\n```clojure\n(with-timeout 30000\n  (async\n    ...))\n```\n\nAlternatively you can set `*timeout*` globally.\n\n## License\n\nCopyright © 2021 Randy Stauner\n\nDistributed under the Eclipse Public License version 1.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwstauner%2Fcljc-test-async","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwstauner%2Fcljc-test-async","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwstauner%2Fcljc-test-async/lists"}