I have a service
class, which 50 other "services" extend. While each service has its own test, I would like to write a test suite for all of the services shared functionality (I have a method thing
which every service has to implement).
To test thing
, every service also has a function thingConfig
which returns an array of configurations thing
can run in. I would like to do the following:
describe('service', () => {
let configs;
before(async () => configs = await service.thingConfig())
configs.forEach(config => {
it(config.name + ' should run thing', () => {
thing = await service.thing(config);
expect(thing).to....
});
});
})
Is it possible to make this dynamic tests (forEach) based on asynchronous data?
it(config.name + ' should run thing', async () => {