Created
December 1, 2019 21:10
-
-
Save jvanderen1/ae502ec7e255625e41cce55a72621f67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Lifecycle', () => { | |
let instance; | |
let newComponent; | |
const updateComponent = (props) => ( | |
<TestPage {...{ ...defaultProps, ...props }} /> | |
); | |
beforeEach(() => { | |
component = getComponent(); | |
instance = component.root.instance; | |
instance.handleSetTableValues = jest.fn(); | |
}); | |
afterEach(() => { | |
jest.clearAllMocks(); | |
}); | |
it('updates table values when `numCols` changes', () => { | |
newComponent = updateComponent({ numCols: 0 }); | |
component.update(newComponent); | |
expect(instance.handleSetTableValues).toHaveBeenCalled(); | |
}); | |
it('updates table values when `numRows` changes', () => { | |
newComponent = updateComponent({ numRows: 0 }); | |
component.update(newComponent); | |
expect(instance.handleSetTableValues).toHaveBeenCalled(); | |
}); | |
it('does not update table values when neither `numCols` or `numRows` changes', () => { | |
newComponent = updateComponent(); | |
component.update(newComponent); | |
expect(instance.handleSetTableValues).not.toHaveBeenCalled(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment