how do I use an array of test data pairs with Deno Test?
Is there a way for me to run an array of test data pairs?
If I do it like this, it will stop after the first failure.
Is there something better than simple inversion?
Is there a way for me to run an array of test data pairs?
If I do it like this, it will stop after the first failure.
Is there something better than simple inversion?
3 Replies
Call Deno.test inside your forEach. If you want each test name to be unique to the case you could generate test name based on the pair.
What would you consider better than that or what is it that you are looking for? In a forEach or a for loop seems like a pretty clean solution.
If what you want is for your data based test cases to be grouped together, you could use the test step api, generating steps instead of top level tests. You can do similar nesting/grouping with bdd. This manual page has examples of test steps and using the std/testing/bdd module.
https://deno.land/manual@v1.26.1/testing/behavior_driven_development
Deno
Behavior-Driven Development | Manual | Deno
With the bdd.ts module you
can write your tests in a familiar format for grouping tests and adding
setup/teardown hooks used by other JavaScript t
thank you. In pytest there is "parametrize" as a standard way to do this.
Was wondering if that was a standard stylied manner here
but I can do it exactly as you describe
thank you.