I use beforeEach
like this in my tests for React components.
let component;
let configProp;
beforeEach(() => {
component = shallow(<MyComponent config={configProp} />);
});
Now, I want to change configProp
variable in tests. Something like this:
let component;
let configProp;
beforeEach(() => {
component = shallow(<MyComponent config={configProp} />);
});
test('config_1', () => {
function firstToRun() {
// runs beforeEach for this test
const config_1 = {};
configProp = config_1;
}
expect(component.find({config: config_1}).exists());
})
Is something like this possible? Or, do we have to shallow(<MyComponent />)
in every test individually?
Aucun commentaire:
Enregistrer un commentaire