Skip to content

Commit

Permalink
fix error when AdvertisingProvider is undefined (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy001 authored and Patrick Hund committed Jun 18, 2019
1 parent 618c940 commit e01f62d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/AdvertisingProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default class AdvertisingProvider extends Component {
}

componentWillUnmount() {
this.teardown();
if (this.props.config) {
this.teardown();
}
}

async teardown() {
Expand Down
6 changes: 6 additions & 0 deletions src/components/AdvertisingProvider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ describe('The AdvertisingProvider component', () => {
}, 0);
});

it('does not tear down the Advertising module if the config is undefined', () => {
provider.unmount();

mockTeardown.should.not.have.been.calledOnce;
});

afterEach(resetMocks);
});

Expand Down

0 comments on commit e01f62d

Please sign in to comment.