diff --git a/test/Async-test.js b/test/Async-test.js index f76bb19801..d8b2607aeb 100644 --- a/test/Async-test.js +++ b/test/Async-test.js @@ -1,4 +1,5 @@ 'use strict'; +/* global describe, it, beforeEach */ /* eslint react/jsx-boolean-value: 0 */ // Emulating the DOM here, only so that if this test file gets @@ -502,8 +503,7 @@ describe('Async', () => { describe('props sync test', () => { it('should update options on componentWillReceiveProps', () => { - createControl({ - }); + createControl({}); asyncInstance.componentWillReceiveProps({ options: [{ label: 'bar', @@ -513,5 +513,27 @@ describe('Async', () => { expect(asyncNode.querySelectorAll('[role=option]').length, 'to equal', 1); expect(asyncNode.querySelector('[role=option]').textContent, 'to equal', 'bar'); }); + + it('should not update options on componentWillReceiveProps', () => { + const props = {options: []}; + createControl(props); + + const setStateStub = sinon.stub(asyncInstance, 'setState'); + asyncInstance.componentWillReceiveProps(props); + + expect(setStateStub, 'was not called'); + + setStateStub.restore(); + }); + }); + + describe('componentWillUnmount', () => { + it('should set _callback to null', () => { + createControl({}); + expect(asyncInstance._callback, 'not to equal', null); + + asyncInstance.componentWillUnmount(); + expect(asyncInstance._callback, 'to equal', null); + }); }); });