{"id":19133646,"url":"https://github.com/gergness/crunchtestdemo","last_synced_at":"2026-06-18T02:31:23.816Z","repository":{"id":48790865,"uuid":"261790347","full_name":"gergness/crunchtestdemo","owner":"gergness","description":null,"archived":false,"fork":false,"pushed_at":"2020-05-07T15:57:32.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-22T17:46:57.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gergness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-06T14:50:05.000Z","updated_at":"2020-05-06T15:30:20.000Z","dependencies_parsed_at":"2022-08-31T13:01:03.596Z","dependency_job_id":null,"html_url":"https://github.com/gergness/crunchtestdemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gergness/crunchtestdemo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gergness%2Fcrunchtestdemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gergness%2Fcrunchtestdemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gergness%2Fcrunchtestdemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gergness%2Fcrunchtestdemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gergness","download_url":"https://codeload.github.com/gergness/crunchtestdemo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gergness%2Fcrunchtestdemo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34474063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T06:23:14.695Z","updated_at":"2026-06-18T02:31:23.794Z","avatar_url":"https://github.com/gergness.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crunchtestdemo\nDemo usage of httptest to capture mocks from the crunch API.\n\nIn this \n[commit](https://github.com/gergness/crunchtestdemo/commit/cce311a552ee45baf4cffe5d3e99426339570bb3), \nwe go from a (simple) working but untested package,\nto one that uses httptest to have mock tests.\n\n## Key steps\n\n- file \n[`inst/httptest/redact.R`](https://github.com/gergness/crunchtestdemo/blob/cce311a552ee45baf4cffe5d3e99426339570bb3/inst/httptest/redact.R) \npulls the `crunch` package's redaction file\nwhich helps make sure that `httptest::capture_requests()` doesn't include\ntokens, and also does some other pruning on the requests.\n  \n- file \n[`fixture-creation/fixture_1.R`](https://github.com/gergness/crunchtestdemo/blob/cce311a552ee45baf4cffe5d3e99426339570bb3/fixture-creation/fixture_1.R) \nis a replayable script that makes the requests we need for a test and saves them into\nthis folder \n[`tests/testthat/fixture1`](https://github.com/gergness/crunchtestdemo/tree/cce311a552ee45baf4cffe5d3e99426339570bb3/tests/testthat/fixture1).\n  \n- Now the test in \n[`tests/testthat/test-crunch_mean_by.R`](https://github.com/gergness/crunchtestdemo/blob/cce311a552ee45baf4cffe5d3e99426339570bb3/tests/testthat/test-crunch_mean_by.R) \ncan use the fixture.\nI've run the same set of tests twice, once with the options being set \nexplicitly, and another with a function modeled after `with_mock_crunch()` \nfrom the crunch package. I modified it so that it takes a directory path,\nbecause I would recommend not having overlapping mocks like the crunch\ndoes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgergness%2Fcrunchtestdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgergness%2Fcrunchtestdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgergness%2Fcrunchtestdemo/lists"}