ljharb / repo-report

CLI to list all repos a user has access to, and report on their configuration in aggregate.
MIT License
24 stars 11 forks source link

Add test to project #33

Closed jakazzy closed 3 years ago

jakazzy commented 3 years ago

This Pull request includes the unit test and integrated test for the repo- report.

So I am currently experiencing a blocker with mocking the request. I tried couple of ways around the request being intercepted after mocking. which involves using fetch-mock, nock, what i have understood so far is that from the searches is that it's not working due to the separate processes. So I presumed using https://github.com/octokit/fixtures might be ideal. I am not really sure though if I'm doing it right. or how to go about it. Currently still on it and I'll appreciate assistance. Thanks @ljharb

jakazzy commented 3 years ago

Overall this seems like a very workable approach!

I think things would be made a bit easier by splitting the implementation into "give me JSON data" and "format JSON data and output it to the CLI" - that way you'd be able to test the former for correctness (mocking the github API responses), and use JSON data fixtures and output snapshots to mock the latter.

We'll want to add github actions files so these get tested; https://github.com/ljharb/unbox-primitive/tree/main/.github/workflows (minus the iojs and zero files) should be useful examples.

ok thank you