-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Procedurally generated tests with an async dependency #1670
Comments
In Jasmine you need to define all your tests (calls to |
if your definition is fetched asynchronously there is nothing we can really do to make it work :( test('some api', () => {
generateApi().then(api => {
return promiseAll(api.routes.map(route => {
return new Promise(route => invariant(true, `${api.name} ${route.name} test failed because of something`));
});
});
}); |
Yeah, probably the direction I’ll go. Although I have been witnessing a Twitter firestorm recently on top level (lot’s of sarcasm, please don’t take seriously) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a project which will automatically generate an API based on some schema data which must be fetched asynchronously. I’d like to provide a testing interface for these automatically generated APIs, say the function
testApi(api)
which will run the necessarydescribe
s andit
s to create an entire test suite for that api. So here’s an example:My first idea was to do something like this:
However, there are two incorrect assumptions here, first is that Jest supports
beforeAll
(as far as I know) and thatdescribe
is executed lazily (i.e. afterbeforeAll
resolves). Any ideas?This is most definitely a niche use case, but I’d like to hear if there is a solution and/or interest to support this use case.
The text was updated successfully, but these errors were encountered: