{"id":27920220,"url":"https://github.com/guanruihua/rh-test","last_synced_at":"2026-03-07T22:31:24.627Z","repository":{"id":62623884,"uuid":"560799391","full_name":"guanruihua/rh-test","owner":"guanruihua","description":"使用测试用例 测试 方法","archived":false,"fork":false,"pushed_at":"2022-11-26T15:32:30.000Z","size":125,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-26T21:42:11.359Z","etag":null,"topics":["test","testing","type","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guanruihua.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-02T09:46:16.000Z","updated_at":"2022-12-08T02:17:40.000Z","dependencies_parsed_at":"2023-01-22T07:45:12.667Z","dependency_job_id":null,"html_url":"https://github.com/guanruihua/rh-test","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guanruihua/rh-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanruihua%2Frh-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanruihua%2Frh-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanruihua%2Frh-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanruihua%2Frh-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guanruihua","download_url":"https://codeload.github.com/guanruihua/rh-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanruihua%2Frh-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30234495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["test","testing","type","typescript"],"created_at":"2025-05-06T20:12:46.545Z","updated_at":"2026-03-07T22:31:24.605Z","avatar_url":"https://github.com/guanruihua.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 描述\n\n- 更名为 **unit-test-js**\n- 添加测试用例来执行是否符合预期\n\n## `test\u003cParam, Tobe\u003e(name:string, func:Func, ...cases: CaseUnit\u003cParam, Tobe\u003e)`\n\n- 泛型\n  - `Param` : 测试用例的参数类型\n  - `Tobe`: 测试用例的结果类型\n- 参数\n  - `name`: 用例名\n  - `func`: 待测试的方法\n  - `...cases`: 测试用例\n\n```ts\n\nexport type CaseUnit\u003cParam, Tobe\u003e = {\n func?: any\n name?: string\n param?: Param\n params?: Param | Param[]\n tobe?: _Tobe\u003cTobe\u003e\n tobes?: _Tobe\u003cTobe\u003e[]\n warningTobe?: _Tobe\u003cTobe\u003e\n warningTobes?: _Tobe\u003cTobe\u003e[]\n type?: CaseUnitType\n paramType?: CaseUnitParamType\n /**\n  * 测试执行前\n  */\n before?: callback\u003cParam, Tobe\u003e\n /**\n  * 判断结果是否正确前\n  */\n beforeEqual?: callback\u003cParam, Tobe\u003e\n /**\n  * 打印结果前\n  */\n after?: callback\u003cParam, Tobe\u003e\n /**\n  * @title 超时时间\n  * @default 2000\n  */\n timeout?: number | 'Infinite'\n run?: {\n  actual: any,\n  runTime: number,\n  error?: string\n }\n [key: string]: any\n}\n\ntest(name, func, {...},{...}, ...)\n// 可以打印出相应的结果\n```\n\n## `equal\u003cParam, Tobe\u003e`\n\n- 等同 `test(name, tobe, ...)`\n- 方法的参数加了默认值\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanruihua%2Frh-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguanruihua%2Frh-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanruihua%2Frh-test/lists"}