Theory is not stringified before being formatted for test case name
Closed this issue · 5 comments
hrafnkellbaldurs commented
If I have this setup:
const theories = [
{ input: null, expected: true},
{ input: '', expected: true }
];
theoretically('myFunction returns {expected} when supplied with {input}', theories, theory => {
expect(myFunction(theory.input)).toBe(theory.expected);
});
Then the output of tests won't be very helpful, since the theories are not stringified before being fed into the test name.
This will output:
'myFunction returns true when supplied with (2ms)'
'myFunction returns true when supplied with (1ms)'
RobPethick commented
We should be able to stringify certain inputs - like null and undefined. What do you think we should do in the case of empty string? Replace it with 'empty string'?
RobPethick commented
Raised an issue here to see if there is a way we can do this with string theories davidchambers/string-format#35
JoshWhite commented
Looks like you can close this bug now... davidchambers/string-format#36
RobPethick commented
Yup - just need to update the string-format version and do a PR for that - or someone else can if they fancy :)
RobPethick commented
fixed in version 1.0.1