Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade To React 16 #18

Merged
merged 4 commits into from
Sep 17, 2019
Merged

Upgrade To React 16 #18

merged 4 commits into from
Sep 17, 2019

Conversation

jmsardina
Copy link
Owner

  • Set React As Peer Dependency
  • Refactor File Structure (PODs)
  • Retire Jasmine In Favor Of Jest

#12 #15

Jennifer added 4 commits January 13, 2019 22:44
As a side effect, this commit also addresses the security vulnerabilities
in development environment (from using Karma).
... but still support the previous version of React.
let wrapper;
let inputField;
const handleChange = jest.fn();
const onDropdownSelect = jest.fn();
Copy link

@albertstill albertstill Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one issue of having a global mocked function is it will preserve state across tests, for example this will pass:

const foo = jest.fn();
  it('foo', () => {
    foo();
    expect(foo).toHaveBeenCalled();
  });
  it('bar', () => {
    expect(foo).toHaveBeenCalled();
  });

a beforeEach solution might be better going forward:

let wrapper;
  let inputField;
  let handleChange;
  let onDropdownSelect;

  beforeEach(() => {
    handleChange = jest.fn();
    onDropdownSelect = jest.fn();
    wrapper = mount(
      <LocationAutocomplete
        value='some value'
        onChange={handleChange}
        onDropdownSelect={onDropdownSelect}
        googleAPIKey='someKey'
      />
    );

    inputField = wrapper.find('input');
  })

Copy link

@alexframe alexframe Jan 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@albertstill in that example you could also just do beforeEach(() => jest.resetAllMocks());

Copy link

@albertstill albertstill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work thanks for doing this mate

@jmsardina jmsardina merged commit 53233fd into master Sep 17, 2019
@jmsardina jmsardina deleted the chore/upgrade-react-version branch September 17, 2019 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants