Closed shaabans closed 4 years ago
I added the actual test in the description, in case it helps spot any issues. Another odd thing I noticed is that using jest-reporter generates a report showing 1 test with NO http calls, which isn't right because I can clearly unmock data being returned, it's just malformed as shown in the description.
Ah ha, after a solid day of bang-head-against-wall, I finally started experimenting and found that removing 'gender: u.oneOf("male", "female")' from my response definition made the generated responses begin working properly again, even though that's one of the supported json-scheme-poet functions.
And, finally, I see my error: u.oneOf('male', 'female')
is wrong, since it sound accept an array. Using u.oneOf(['male', 'female'])
is right and works.
This either fails silently, or causes really strange results, so I guess a more graceful failure could be a good feature to consider.
Glad you found the solution! I'm the author of json-schema-poet
- the documentation is pretty bad, so I'll try to add function signatures to it.
One question @shaabans - are you using typescript? If not, does your IDE show the function signature for those functions? I work mostly in typescript & VSCode, so the more feedback I can get from devs using other environments, the better I can make the library. Thanks!
Hey Mike, thanks for the reply and the hard work on this project, it's a great tool.
We're using ES6 (although considering TypeScript), and I don't see function signatures while using Atom (haven't tried in VSCode).
Hi, I'm not sure if this is just a dumb question or if it should be a bug. I'm using version 0.3.16, and trying something like this to mock an Axios API in a React Native project:
The results coming back don't seem to be fully resolved into final values, for example:
The test itself looks like this:
Thanks in advance for any tips, and for the great testing tool!