I am having a test that checks the response from an API route, but basically more of the same kind of routes will be added.
The routes only change like this:
- /example/route/
red - /example/route/
green
I am creating an array of strings:
const ending = [
"red",
"green"
]
Then I loop into the array and use the same describe method to test this functionality
ending.forEach(table => {
describe(`${table} routes`, () => {
// My test goes here
}
}
Is working, but the question is if this is a good practice in testing?
Or if this could cause an unexpected behaviour later?
Thanks!
Aucun commentaire:
Enregistrer un commentaire