Skip to content

Commit

Permalink
test(fix): fix broken test after deps upgrade
Browse files Browse the repository at this point in the history
affects: @tao.js/react
  • Loading branch information
eudaimos committed Feb 5, 2022
1 parent a63d50f commit efe3c37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-tao/src/Reactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Reactor extends Component {

componentWillUnmount() {
const { adapter } = this.props;
adapter.unregisterReactor(this);
adapter && adapter.unregisterReactor && adapter.unregisterReactor(this);
}

componentDidUpdate(prevProps) {
Expand Down
4 changes: 4 additions & 0 deletions packages/react-tao/test/Reactor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ describe('Reactor exports a React Component for reacting to TAO App Contexts', (
wrapper.instance(),
expect.any(Function)
);
registerMock.mockReset();
registerMock.mockRestore();
});

it('should unregister from the Adapter when unmounting', () => {
Expand All @@ -106,6 +108,8 @@ describe('Reactor exports a React Component for reacting to TAO App Contexts', (
// Assert
expect(unregisterMock).toHaveBeenCalledTimes(1);
expect(unregisterMock).toHaveBeenCalledWith(wrapperInstance);
unregisterMock.mockReset();
unregisterMock.mockRestore();
});

it('should not render a component without an AC being triggered', () => {
Expand Down

0 comments on commit efe3c37

Please sign in to comment.