I am trying to create a unit test using react,ava, etc..I am having issue creating a simple unit test to check if a method was called. My test should pass if the method has been called. However when i check the code coverage I get a message saying "function not covered". Below is the code I am using to test it.
import test from 'ava';
import React from 'react';
import { Cart } from 'components/Cart/CartDisplay';
import { shallow } from 'enzyme';
let props;
test.beforeEach(() => {
props = {
popError: () => {},
message: '',
count: 2,
displayCart:() => {},
onClose:() => {}
};
});
test('renders okay?', (t) => {
shallow(
<Cart {...props} />
);
t.pass('yes');
});
test('Cart Displayed okay?', (t) => {
props.displayCart();
t.pass('yes');
});
What am I doing wrong?