This repository has been archived by the owner on Sep 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds AlternateAddress to foreign contact
- Loading branch information
1 parent
6ab4adc
commit 04e9dc5
Showing
10 changed files
with
67 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import configureMockStore from 'redux-mock-store' | ||
import { Provider } from 'react-redux' | ||
import Contacts from './Contacts' | ||
|
||
const alternateAddressRenderMock = jest.fn(); | ||
const mountComponent = (mockStore, Component, props) => { | ||
const store = mockStore({ application: { AddressBooks: {} }}) | ||
const finalProps = { | ||
render: alternateAddressRenderMock, | ||
...props | ||
} | ||
|
||
return mount( | ||
<Provider store={store}> | ||
<Component {...finalProps} /> | ||
</Provider> | ||
) | ||
} | ||
|
||
describe('The contacts component', () => { | ||
it('display nothing when "no" is clicked', () => { | ||
const mockStore = configureMockStore() | ||
const expected = { | ||
name: 'foreign-contacts', | ||
HasForeignContacts: { value: 'No' } | ||
} | ||
const component = mount(<Contacts {...expected} />) | ||
const component = mountComponent(mockStore, Contacts, expected) | ||
expect(component.find('.accordion').length).toBe(0) | ||
}) | ||
|
||
it('display accordion when "yes" is clicked', () => { | ||
const mockStore = configureMockStore() | ||
const expected = { | ||
name: 'foreign-contacts', | ||
HasForeignContacts: { value: 'Yes' }, | ||
List: { branch: {}, items: [{ Item: { Name: {} } }] } | ||
} | ||
const component = mount(<Contacts {...expected} />) | ||
const component = mountComponent(mockStore, Contacts, expected) | ||
expect(component.find('.accordion').length).toBe(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters