diff --git a/test/components/Nav.spec.js b/test/components/Nav.spec.js index 86dbf88e..73a9b761 100644 --- a/test/components/Nav.spec.js +++ b/test/components/Nav.spec.js @@ -21,8 +21,8 @@ describe('default elements', () => { it('should render nav links', () => { expect(el.find(NavLink).at(0).props().to).toBe('/') - expect(el.find(NavLink).at(1).props().to).toBe('/peers') - expect(el.find(NavLink).at(2).props().to).toBe('/channels') + expect(el.find(NavLink).at(1).props().to).toBe('/contacts') + expect(el.find(NavLink).at(2).props().to).toBe('/network') }) it('should render buttons', () => { expect(el.find('.button').at(0).text()).toContain('Pay') diff --git a/test/reducers/__snapshots__/balance.spec.js.snap b/test/reducers/__snapshots__/balance.spec.js.snap new file mode 100644 index 00000000..f1d37985 --- /dev/null +++ b/test/reducers/__snapshots__/balance.spec.js.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers balanceReducer should handle DECREMENT_COUNTER 1`] = ` +Object { + "balanceLoading": false, + "channelBalance": undefined, + "walletBalance": undefined, +} +`; + +exports[`reducers balanceReducer should handle INCREMENT_COUNTER 1`] = ` +Object { + "balanceLoading": true, + "channelBalance": null, + "walletBalance": null, +} +`; + +exports[`reducers balanceReducer should handle initial state 1`] = ` +Object { + "balanceLoading": false, + "channelBalance": null, + "walletBalance": null, +} +`; + +exports[`reducers balanceReducer should handle unknown action type 1`] = ` +Object { + "balanceLoading": false, + "channelBalance": null, + "walletBalance": null, +} +`; diff --git a/test/reducers/__snapshots__/channels.spec.js.snap b/test/reducers/__snapshots__/channels.spec.js.snap new file mode 100644 index 00000000..18f6b4ee --- /dev/null +++ b/test/reducers/__snapshots__/channels.spec.js.snap @@ -0,0 +1,344 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers channelsReducer should correctly getChannels 1`] = ` +Object { + "channel": null, + "channelForm": Object { + "isOpen": false, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [], + "channelsLoading": true, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": false, + "pendingChannels": Object { + "pending_closing_channels": Array [], + "pending_force_closing_channels": Array [], + "pending_open_channels": Array [], + "total_limbo_balance": "", + }, + "searchQuery": "", + "viewType": 0, +} +`; + +exports[`reducers channelsReducer should correctly openingChannel 1`] = ` +Object { + "channel": null, + "channelForm": Object { + "isOpen": false, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [], + "channelsLoading": false, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": true, + "pendingChannels": Object { + "pending_closing_channels": Array [], + "pending_force_closing_channels": Array [], + "pending_open_channels": Array [], + "total_limbo_balance": "", + }, + "searchQuery": "", + "viewType": 0, +} +`; + +exports[`reducers channelsReducer should correctly receiveChannel 1`] = ` +Object { + "channel": null, + "channelForm": Object { + "isOpen": false, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [ + 1, + 2, + ], + "channelsLoading": false, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": false, + "pendingChannels": Array [ + 3, + 4, + ], + "searchQuery": "", + "viewType": 0, +} +`; + +exports[`reducers channelsReducer should correctly setChannel 1`] = ` +Object { + "channel": "channel", + "channelForm": Object { + "isOpen": false, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [], + "channelsLoading": false, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": false, + "pendingChannels": Object { + "pending_closing_channels": Array [], + "pending_force_closing_channels": Array [], + "pending_open_channels": Array [], + "total_limbo_balance": "", + }, + "searchQuery": "", + "viewType": 0, +} +`; + +exports[`reducers channelsReducer should correctly setChannelForm 1`] = ` +Object { + "channel": null, + "channelForm": Object { + "isOpen": true, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [], + "channelsLoading": false, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": false, + "pendingChannels": Object { + "pending_closing_channels": Array [], + "pending_force_closing_channels": Array [], + "pending_open_channels": Array [], + "total_limbo_balance": "", + }, + "searchQuery": "", + "viewType": 0, +} +`; + +exports[`reducers channelsReducer should handle initial state 1`] = ` +Object { + "channel": null, + "channelForm": Object { + "isOpen": false, + "local_amt": "", + "node_key": "", + "push_amt": "", + }, + "channels": Array [], + "channelsLoading": false, + "closingChannel": false, + "closingChannelIds": Array [], + "contactModal": Object { + "channel": null, + "isOpen": false, + }, + "filter": Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + "filterPulldown": false, + "filters": Array [ + Object { + "key": "ALL_CHANNELS", + "name": "All Contacts", + }, + Object { + "key": "ACTIVE_CHANNELS", + "name": "Online Contacts", + }, + Object { + "key": "NON_ACTIVE_CHANNELS", + "name": "Offline Contacts", + }, + Object { + "key": "OPEN_PENDING_CHANNELS", + "name": "Pending Contacts", + }, + Object { + "key": "CLOSING_PENDING_CHANNELS", + "name": "Closing Contacts", + }, + ], + "loadingChannelPubkeys": Array [], + "openingChannel": false, + "pendingChannels": Object { + "pending_closing_channels": Array [], + "pending_force_closing_channels": Array [], + "pending_open_channels": Array [], + "total_limbo_balance": "", + }, + "searchQuery": "", + "viewType": 0, +} +`; diff --git a/test/reducers/__snapshots__/form.spec.js.snap b/test/reducers/__snapshots__/form.spec.js.snap new file mode 100644 index 00000000..2b1d763d --- /dev/null +++ b/test/reducers/__snapshots__/form.spec.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers formReducer should correctly setFormType 1`] = ` +Object { + "formType": "FOO", +} +`; + +exports[`reducers formReducer should handle initial state 1`] = ` +Object { + "formType": null, +} +`; diff --git a/test/reducers/__snapshots__/info.spec.js.snap b/test/reducers/__snapshots__/info.spec.js.snap new file mode 100644 index 00000000..1fd77f2b --- /dev/null +++ b/test/reducers/__snapshots__/info.spec.js.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers infoReducer should correctly getInfo 1`] = ` +Object { + "data": Object {}, + "infoLoading": true, +} +`; + +exports[`reducers infoReducer should correctly receiveInfo 1`] = ` +Object { + "data": "foo", + "infoLoading": false, +} +`; + +exports[`reducers infoReducer should handle initial state 1`] = ` +Object { + "data": Object {}, + "infoLoading": false, +} +`; diff --git a/test/reducers/__snapshots__/invoice.spec.js.snap b/test/reducers/__snapshots__/invoice.spec.js.snap new file mode 100644 index 00000000..c2d59f50 --- /dev/null +++ b/test/reducers/__snapshots__/invoice.spec.js.snap @@ -0,0 +1,171 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers invoiceReducer should correctly getInvoice 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": true, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly getInvoices 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": true, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly invcoiceFailed 1`] = ` +Object { + "data": null, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly invcoiceSuccessful 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [ + "foo", + ], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly receiveFormInvoice 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly receiveInvoice 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": "foo", + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly receiveInvoices 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [ + 1, + 2, + ], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly searchInvoices 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "foo", +} +`; + +exports[`reducers invoiceReducer should correctly sendInvoice 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": true, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should correctly setInvoice 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": "foo", + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "", +} +`; + +exports[`reducers invoiceReducer should handle initial state 1`] = ` +Object { + "data": Object {}, + "formInvoice": Object { + "amount": "0", + "payreq": "", + "r_hash": "", + }, + "invoice": null, + "invoiceLoading": false, + "invoices": Array [], + "invoicesSearchText": "", +} +`; diff --git a/test/reducers/__snapshots__/payment.spec.js.snap b/test/reducers/__snapshots__/payment.spec.js.snap new file mode 100644 index 00000000..fe7667c3 --- /dev/null +++ b/test/reducers/__snapshots__/payment.spec.js.snap @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers paymentReducer should correctly getPayments 1`] = ` +Object { + "payment": null, + "paymentLoading": true, + "payments": Array [], + "sendingPayment": false, +} +`; + +exports[`reducers paymentReducer should correctly paymentSuccessful 1`] = ` +Object { + "payment": null, + "paymentLoading": false, + "payments": Array [], + "sendingPayment": false, +} +`; + +exports[`reducers paymentReducer should correctly receivePayments 1`] = ` +Object { + "payment": null, + "paymentLoading": false, + "payments": Array [ + 1, + 2, + ], + "sendingPayment": false, +} +`; + +exports[`reducers paymentReducer should correctly sendPayment 1`] = ` +Object { + "payment": "foo", + "paymentLoading": false, + "payments": Array [], + "sendingPayment": false, +} +`; + +exports[`reducers paymentReducer should handle initial state 1`] = ` +Object { + "payment": null, + "paymentLoading": false, + "payments": Array [], + "sendingPayment": false, +} +`; diff --git a/test/reducers/__snapshots__/peers.spec.js.snap b/test/reducers/__snapshots__/peers.spec.js.snap new file mode 100644 index 00000000..69bcafdd --- /dev/null +++ b/test/reducers/__snapshots__/peers.spec.js.snap @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers peersReducer should correctly connectFailure 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly connectPeer 1`] = ` +Object { + "connecting": true, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly connectSuccess 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [ + "foo", + ], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly disconnectFailure 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly disconnectPeer 1`] = ` +Object { + "connecting": false, + "disconnecting": true, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly disconnectSuccess 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly getPeers 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": true, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly receivePeers 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": "foo", + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly setPeer 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": "foo", + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should correctly setPeerForm 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "0": "f", + "1": "o", + "2": "o", + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; + +exports[`reducers peersReducer should handle initial state 1`] = ` +Object { + "connecting": false, + "disconnecting": false, + "peer": null, + "peerForm": Object { + "host": "", + "isOpen": false, + "pubkey": "", + }, + "peers": Array [], + "peersLoading": false, + "searchQuery": "", +} +`; diff --git a/test/reducers/__snapshots__/ticker.spec.js.snap b/test/reducers/__snapshots__/ticker.spec.js.snap new file mode 100644 index 00000000..06102a8b --- /dev/null +++ b/test/reducers/__snapshots__/ticker.spec.js.snap @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`reducers tickerReducer should correctly getTicker 1`] = ` +Object { + "btcTicker": null, + "crypto": "", + "currency": "", + "ltcTicker": null, + "tickerLoading": true, +} +`; + +exports[`reducers tickerReducer should correctly receiveTicker 1`] = ` +Object { + "btcTicker": undefined, + "crypto": "", + "currency": "", + "ltcTicker": undefined, + "tickerLoading": false, +} +`; + +exports[`reducers tickerReducer should correctly setCrypto 1`] = ` +Object { + "btcTicker": null, + "crypto": "foo", + "currency": "", + "ltcTicker": null, + "tickerLoading": false, +} +`; + +exports[`reducers tickerReducer should correctly setCurrency 1`] = ` +Object { + "btcTicker": null, + "crypto": "", + "currency": "foo", + "ltcTicker": null, + "tickerLoading": false, +} +`; + +exports[`reducers tickerReducer should handle initial state 1`] = ` +Object { + "btcTicker": null, + "crypto": "", + "currency": "", + "ltcTicker": null, + "tickerLoading": false, +} +`;