{"action":"created","issue":{"url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/12","repository_url":"https://api.github.com/repos/alexkuz/react-input-enhancements","labels_url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/12/comments","events_url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/12/events","html_url":"https://github.com/alexkuz/react-input-enhancements/issues/12","id":146056501,"number":12,"title":"Undefined is not a constructor when unit testing with enzyme mount()","user":{"login":"CLL80","id":6164653,"avatar_url":"https://avatars.githubusercontent.com/u/6164653?v=3","gravatar_id":"","url":"https://api.github.com/users/CLL80","html_url":"https://github.com/CLL80","followers_url":"https://api.github.com/users/CLL80/followers","following_url":"https://api.github.com/users/CLL80/following{/other_user}","gists_url":"https://api.github.com/users/CLL80/gists{/gist_id}","starred_url":"https://api.github.com/users/CLL80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CLL80/subscriptions","organizations_url":"https://api.github.com/users/CLL80/orgs","repos_url":"https://api.github.com/users/CLL80/repos","events_url":"https://api.github.com/users/CLL80/events{/privacy}","received_events_url":"https://api.github.com/users/CLL80/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-05T17:32:45Z","updated_at":"2016-04-11T18:38:03Z","closed_at":null,"body":"We are using the react-input-enhancements combobox on a form we're unit testing with [enzyme](https://github.com/airbnb/enzyme). We have some child components within the component that we would like to test using a full rendering mount with enzyme, but when mounting it, we get this error from the combobox:\r\n\r\n```\r\nundefined is not a constructor (evaluating '[opt, opt.text, opt.label, opt.value].find(function (value) {\r\n\treturn typeof value === 'string';\r\n})')\r\n```\r\n\r\nI've logged `opt`. It and all it's child properties are logging successfully for the first combobox, but for some reason, it seems to fail after this. All subsequent objects in the array are also valid. I can't find what is actually undefined here. Note that this `undefined is not a constructor` error only happens when unit testing—not when running the actual front-end.\r\n\r\nHere is the combobox element:\r\n```\r\n<div className='input-group'>\r\n\t<label htmlFor='create-account-country'>Country<span className='required'>*</span></label>\r\n\t<Combobox\r\n\t\tclassName='select-container'\r\n\t\tdefaultValue={form['create-account-country']}\r\n\t\toptions={this.props.countryOptions}\r\n\t\tautocomplete\r\n\t\tonValueChange={this.valueChange('create-account-country', 'country')}\r\n\t\tdata-fieldname='country'\r\n\t\t>\r\n\t\t<input\r\n\t\t\ttype='text'\r\n\t\t\tplaceholder='Please select your country'\r\n\t\t\tid='create-account-country'\r\n\t\t\tname='create-account-country'\r\n\t\t\tclassName={'form-control select' + (!this.isValid('country') ? ' error' : '')}\r\n\t\t\trequired\r\n\t\t\t/>\r\n\t</Combobox>\r\n</div>\r\n```\r\n\r\nHere is the options property that is passed to the combobox:\r\n\r\n```\r\ncountryOptions: [\r\n\t{\r\n\t\tvalue: 'USA',\r\n\t\ttext: 'United States',\r\n\t\tlabel: 'United States'\r\n\t},\r\n\t{\r\n\t\tvalue: 'Canada',\r\n\t\ttext: 'Canada',\r\n\t\tlabel: 'Canada'\r\n\t}\r\n]\r\n```\r\n\r\nI're not sure if this issue should be addressed within react-input-enhancements or enyzme but would appreciate any advice you may have in resolving it."},"comment":{"url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/comments/208490559","html_url":"https://github.com/alexkuz/react-input-enhancements/issues/12#issuecomment-208490559","issue_url":"https://api.github.com/repos/alexkuz/react-input-enhancements/issues/12","id":208490559,"user":{"login":"CLL80","id":6164653,"avatar_url":"https://avatars.githubusercontent.com/u/6164653?v=3","gravatar_id":"","url":"https://api.github.com/users/CLL80","html_url":"https://github.com/CLL80","followers_url":"https://api.github.com/users/CLL80/followers","following_url":"https://api.github.com/users/CLL80/following{/other_user}","gists_url":"https://api.github.com/users/CLL80/gists{/gist_id}","starred_url":"https://api.github.com/users/CLL80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CLL80/subscriptions","organizations_url":"https://api.github.com/users/CLL80/orgs","repos_url":"https://api.github.com/users/CLL80/repos","events_url":"https://api.github.com/users/CLL80/events{/privacy}","received_events_url":"https://api.github.com/users/CLL80/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T18:38:03Z","updated_at":"2016-04-11T18:38:03Z","body":"Thanks for your patience during the delay. Attached is a sample project where the issue can be reproduced. Here are the versions of node and npm we are running:\r\nnpm 3.8.2\r\nnode v4.4.0\r\n\r\nTo see the error, run `npm run test` in the root directory. Let me know if I can help with anything.\r\n\r\n[combobox-issue.zip](https://github.com/alexkuz/react-input-enhancements/files/213637/combobox-issue.zip)"}}