{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/react-intl/issues/686","repository_url":"https://api.github.com/repos/yahoo/react-intl","labels_url":"https://api.github.com/repos/yahoo/react-intl/issues/686/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/react-intl/issues/686/comments","events_url":"https://api.github.com/repos/yahoo/react-intl/issues/686/events","html_url":"https://github.com/yahoo/react-intl/issues/686","id":182400656,"number":686,"title":"Unit testing issues with formatNumber.","user":{"login":"andrewheppner","id":12014696,"avatar_url":"https://avatars.githubusercontent.com/u/12014696?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewheppner","html_url":"https://github.com/andrewheppner","followers_url":"https://api.github.com/users/andrewheppner/followers","following_url":"https://api.github.com/users/andrewheppner/following{/other_user}","gists_url":"https://api.github.com/users/andrewheppner/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewheppner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewheppner/subscriptions","organizations_url":"https://api.github.com/users/andrewheppner/orgs","repos_url":"https://api.github.com/users/andrewheppner/repos","events_url":"https://api.github.com/users/andrewheppner/events{/privacy}","received_events_url":"https://api.github.com/users/andrewheppner/received_events","type":"User","site_admin":false},"labels":[{"id":156565081,"url":"https://api.github.com/repos/yahoo/react-intl/labels/support","name":"support","color":"f7c6c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-11T23:36:17Z","updated_at":"2017-01-12T14:29:39Z","closed_at":"2016-12-23T00:15:14Z","body":"I am having the following issue when trying to test out a component that uses the formatNumber method.\n\n`ERROR: '[React Intl] Error formatting number.\nReferenceError: No locale data has been provided for this object yet.'\nERROR: '[React Intl] Error formatting number.\nReferenceError: No locale data has been provided for this object yet.'`\n\nHere is the unit test setup...\n\n```\nimport React from 'react';\nimport SkinDeep from 'skin-deep';\nimport { CountryMenu } from '../index';\nimport 'intl';\nimport { IntlProvider, addLocaleData } from 'react-intl';\nimport enLocaleData from 'react-intl/locale-data/en';\n\naddLocaleData(enLocaleData);\n\ndescribe('Research/Toolbar/AdvancedFiltersPanel/Location/CountryMenu', () => {\n    const intlProvider = new IntlProvider({\n        locale: 'en',\n        messages: { test: 'test' },\n    }, {});\n    const { intl } = intlProvider.getChildContext();\n    let tree;\n    let instance;\n\n```\n\n```\nbeforeEach(() => {\n    tree = SkinDeep.shallowRender(\n        <CountryMenu\n            onSelect={() => {}}\n            location={{\n                buyerCountryCode: 'US',\n                sellerCountryCode: 'UK',\n            }}\n            filterTotals={{\n                US: '1',\n                UK: '2',\n            }}\n            filterOption=\"buyerCountryCode\"\n            intl={intl}\n        />\n    );\n    instance = tree.getMountedInstance();\n});\n\nit('shouldComponentUpdate is working correctly when filterTotals prop changes', () => {\n    const nextProps = Object.assign({}, instance.props, {\n        filterTotals: {\n            US: '2',\n            UK: '2',\n        },\n    });\n    expect(instance.shouldComponentUpdate(nextProps)).toEqual(true);\n});`\n```\n\nI am running these tests using Karma and phantomJS.\n\nAny ideas about why the locale is still being seen as not provided? What am I missing?\n"},"comment":{"url":"https://api.github.com/repos/yahoo/react-intl/issues/comments/272176909","html_url":"https://github.com/yahoo/react-intl/issues/686#issuecomment-272176909","issue_url":"https://api.github.com/repos/yahoo/react-intl/issues/686","id":272176909,"user":{"login":"bziorkiewicz","id":6122057,"avatar_url":"https://avatars.githubusercontent.com/u/6122057?v=3","gravatar_id":"","url":"https://api.github.com/users/bziorkiewicz","html_url":"https://github.com/bziorkiewicz","followers_url":"https://api.github.com/users/bziorkiewicz/followers","following_url":"https://api.github.com/users/bziorkiewicz/following{/other_user}","gists_url":"https://api.github.com/users/bziorkiewicz/gists{/gist_id}","starred_url":"https://api.github.com/users/bziorkiewicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bziorkiewicz/subscriptions","organizations_url":"https://api.github.com/users/bziorkiewicz/orgs","repos_url":"https://api.github.com/users/bziorkiewicz/repos","events_url":"https://api.github.com/users/bziorkiewicz/events{/privacy}","received_events_url":"https://api.github.com/users/bziorkiewicz/received_events","type":"User","site_admin":false},"created_at":"2017-01-12T14:29:39Z","updated_at":"2017-01-12T14:29:39Z","body":"@ericf, thank you for this answer. I spent few days looking for solution. In my case PhantomJS didn't show any error. Shouldn't react-intl throw some errors to console when there is no Intl API?"}}
{"actor":{"display_login":"bziorkiewicz"}}