Got other test passing. all green!
This commit is contained in:
1 parent
2abb0a40ec
commit
c5a1a157df
1 file changed
+19
-19
@@ -6,25 +6,25 @@ const renderer = require('react-test-renderer');
|
||||
const VM = require('scratch-vm');
|
||||
|
||||
describe('GreenFlag', () => {
|
||||
let vm;
|
||||
beforeEach(() => {
|
||||
// TODO(bogusred): Ask scratch team their thoughts on mocking the VM.
|
||||
vm = new VM();
|
||||
});
|
||||
let vm;
|
||||
beforeEach(() => {
|
||||
// TODO(bogusred): Ask scratch team their thoughts on mocking the VM.
|
||||
vm = new VM();
|
||||
});
|
||||
|
||||
test('renders active state', () => {
|
||||
const component = renderer.create(
|
||||
<GreenFlag active={true} vm={vm}/>
|
||||
);
|
||||
expect(component.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
test('renders active state', () => {
|
||||
const component = renderer.create(
|
||||
<GreenFlag active={true} vm={vm}/>
|
||||
);
|
||||
expect(component.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('triggers onClick when active', () => {
|
||||
const onClick = jest.fn();
|
||||
const component = shallow(
|
||||
<GreenFlag active={true} onClick={onClick} vm={vm}/>
|
||||
);
|
||||
component.find('img').simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
test('triggers onClick when active', () => {
|
||||
const onClick = jest.fn();
|
||||
const componentShallowWrapper = shallow(
|
||||
<GreenFlag active={true} onClick={onClick} vm={vm}/>
|
||||
);
|
||||
componentShallowWrapper.simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user