-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate mock data for tests from specific repositories #11
base: main
Are you sure you want to change the base?
Conversation
if (process.env.NODE_ENV === 'TEST') { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we want to skip logging in tests, as opposed to passing in the logger (and mocking that in tests)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the log messages are polluting the test results with messages like Some checks are pending
popping up in betweeen - or we can redirect the stream too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that the logger function can be passed down from the top level, and be defaulted to console.log
, but that tests can pass something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! that sounds good and makes sense! will do the changes.
7edf685
to
d4f5589
Compare
I will be jumping into this as well but there is one mock that's going to be hard to generate which are the |
Sure, let’s start with that :-) |
d4f5589
to
cdec4a3
Compare
So currently, we fetch from GitHub api and run the relevant tests on those responses.
Some issues I have with this implementation:
Which is why I would like to propose that we can set up a dummy repo with set statuses (hopefully as much as possible) which we can test against. Also this will help validate our implementation because we already know beforehand what the status is - instead of checking it only when the response is returned. |
I think a dummy repo makes perfect sense. Want to make it and set it up, and then later you can transfer it to me so it can live alongside this one? |
Awesome that sounds like a plan! |
One thing I came across which may be a non-issue is that if the user doesn't have an internet connection they may not be able to fetch the mocks and run the tests. Maybe we should leave the current mocks in as default and then if the user wants to fetch the latest they can do so? |
Or maybe it can just be left as is because the tool is reliant on having an internet connection? |
My expectation is that the mocks should be committed to git, and updateable only manually by an explicit command; that way, no internet connection is required to run tests. |
Closes #7.
Fetches the last PR status for the repos specified in
test/repos.json
, determines the expected test results, and saves the responses totest/mocks.json
. Addedfetch-mocks
script to fetch those responses for the first time. On subsequent runs, the evaluation subroutine can be tested against those responses.