This file contains hidden or 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
    
  
  
    
  | it("renders the invoice coming from server", (done) => { | |
| const invoice = { | |
| reference: '0001', | |
| amount: '10.00', | |
| }; | |
| spyNotifier.slowOperationFinished = () => { | |
| let billRow = page.find(BillsTable).first().find(BillRow); | |
| expect(billRow.length).toBe(1); | |
| done(); | |
| }; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | it("populates the store with server data", (done) => { | |
| const invoice = { | |
| reference: '0001', | |
| amount: '10.00', | |
| }; | |
| store.subscribe(() => { | |
| expect(store.getState().billing.invoices[0]).toEqual(invoice); | |
| done(); | |
| }); | |
| stubApi.getInvoices = () =>{ | 
  
    
      This file contains hidden or 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
    
  
  
    
  | beforeEach(function () { | |
| spyRouter = { push: jest.fn() }; | |
| initialState = {profile: {id: '123456789H'}}; | |
| store = configureStore(initialState); | |
| }); | |
| it("clears store's state on logout", (done) => { | |
| expect(store.getState().profile.id).toEqual(initialState.profile.id); | |
| store.subscribe(() => { | |
| expect(store.getState().profile.id).toEqual(''); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | beforeEach(()=> { | |
| form = shallow(<AddressForm | |
| address={{}} | |
| actions={actions} | |
| />); | |
| }); | |
| it('contains exactly one email input for every address email', () => { | |
| let address = addressBuilder().withEmails([email0, email1]).build(); | |
| form.setProps({address: address}); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | it('deletes email when button is clicked', () => { | |
| let address = addressBuilder().withEmails([email0, email1]).build(); | |
| form.setProps({address: address}); | |
| actions.updateEmails = jest.fn((value) => { | |
| expect(value).toEqual(email1); | |
| }); | |
| const buttons = form.find(inputByClass(deleteEmailCss)); | |
| simulateClick(buttons.first()); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | function saveAddress(address, serverApi) { | |
| return function(dispatch, getState) { | |
| dispatch({ | |
| type: types.SAVE_ADDRESS, | |
| address: address | |
| }); | |
| let cleanAddress = getState().address; | |
| return serverApi.saveAddress(cleanAddress).then((json) => { | |
| if (areEmailsDifferent(cleanAddress, address)) { | |
| let response = Object.assign({}, json); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | function loadProfile(serverApi) { | |
| return function (dispatch) { | |
| return serverApi.getProfile().then((json) => { | |
| return dispatch({ | |
| type: types.GET_PROFILE, | |
| profile: json | |
| }); | |
| }); | |
| }; | |
| } | 
  
    
      This file contains hidden or 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
    
  
  
    
  | let stubApi = {}; | |
| let store; | |
| let stubRouter = { | |
| location: { | |
| search: '', | |
| query: { | |
| toDay: '', | |
| fromDay: '' | |
| } | |
| }, | 
  
    
      This file contains hidden or 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
    
  
  
    
  | export const createPage = (serverApi, mapState) => { | |
| return connect( | |
| (state) => { | |
| let mapping = { | |
| report: state.report | |
| }; | |
| if (typeof(mapState) === 'function'){ | |
| return Object.assign(mapping, mapState(state)); | |
| } | |
| return mapping; | 
  
    
      This file contains hidden or 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
    
  
  
    
  | it ('populates store with data returned from server', (done) => { | |
| stubApiClientToReturn({username: 'carlos'}); | |
| simulateSearchFormSubmit({username: 'car'}); | |
| expectStoredUsersToContainUsername('carlos', done); | |
| }); | |
| function expectStoredUsersToContainUsername(username, done){ | |
| store.subscribe(eventuallyExpect(() => { |