Skip to content

Commit

Permalink
fix(Refresh): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed Jun 23, 2018
1 parent 408e152 commit 286a4c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/blockchain-wallet-v4-frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const configureStore = () => {
.then(res => res.json())
.then(options => {
const apiKey = '1770d5d9-bcea-4d28-ad21-6cbd5be018a8'
const bchSocket = new Socket({ options, socketType: '/bch' })
const btcSocket = new Socket({ options, socketType: '' })
const bchSocket = new Socket({ options, socketType: '/bch' })
const ethSocket = new Socket({ options, socketType: '/eth' })
const api = createWalletApi({ options, apiKey })

Expand All @@ -53,9 +53,9 @@ const configureStore = () => {
sagaMiddleware,
routerMiddleware(history),
coreMiddleware.kvStore({ isAuthenticated, api, kvStorePath }),
webSocketBtc(btcSocket),
webSocketBch(bchSocket),
webSocketEth(ethSocket),
webSocketBtc(btcSocket),
coreMiddleware.walletSync({ isAuthenticated, api, walletPath }),
autoDisconnection()
),
Expand Down
18 changes: 9 additions & 9 deletions packages/blockchain-wallet-v4-frontend/src/store/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jest.mock('config', () => {
describe('App Store Config', () => {
let apiKey = '1770d5d9-bcea-4d28-ad21-6cbd5be018a8'
let fakeWalletOptions = { domains: { webSocket: 'MOCK_SOCKET', root: 'MOCK_ROOT' } }
let createStoreSpy, applyMiddlewareSpy, composeSpy, kvStoreSpy, btcSocketSpy, walletSyncSpy, autoDisconnectSpy, bchSocketSpy, ethSocketSpy
let createStoreSpy, applyMiddlewareSpy, composeSpy, kvStoreSpy, walletSyncSpy, autoDisconnectSpy, btcSocketSpy, bchSocketSpy, ethSocketSpy

beforeAll(() => {
// setup fetch mock
Expand All @@ -53,10 +53,10 @@ describe('App Store Config', () => {
applyMiddlewareSpy = jest.spyOn(Redux, 'applyMiddleware')
composeSpy = jest.spyOn(Redux, 'compose').mockImplementation(jest.fn())
kvStoreSpy = jest.spyOn(CoreSrc.coreMiddleware, 'kvStore')
btcSocketSpy = jest.spyOn(CoreSrc.coreMiddleware.socket, 'bitcoin')
bchSocketSpy = jest.spyOn(CoreSrc.coreMiddleware.socket, 'bch')
ethSocketSpy = jest.spyOn(CoreSrc.coreMiddleware.socket, 'ethereum')
walletSyncSpy = jest.spyOn(CoreSrc.coreMiddleware, 'walletSync')
btcSocketSpy = jest.spyOn(Middleware, 'webSocketBtc')
bchSocketSpy = jest.spyOn(Middleware, 'webSocketBch')
ethSocketSpy = jest.spyOn(Middleware, 'webSocketEth')
autoDisconnectSpy = jest.spyOn(Middleware, 'autoDisconnection')
})

Expand All @@ -71,8 +71,8 @@ describe('App Store Config', () => {
// socket registration
expect(Socket.mock.calls.length).toEqual(3)
expect(Socket.mock.calls[0][0]).toEqual({ options: fakeWalletOptions, socketType: '' })
expect(Socket.mock.calls[1][0]).toEqual({ options: fakeWalletOptions, socketType: '/eth' })
expect(Socket.mock.calls[2][0]).toEqual({ options: fakeWalletOptions, socketType: '/bch' })
expect(Socket.mock.calls[1][0]).toEqual({ options: fakeWalletOptions, socketType: '/bch' })
expect(Socket.mock.calls[2][0]).toEqual({ options: fakeWalletOptions, socketType: '/eth' })
// build api
expect(createWalletApi.mock.calls.length).toBe(1)
expect(createWalletApi.mock.calls[0][0]).toEqual({
Expand All @@ -87,11 +87,11 @@ describe('App Store Config', () => {
kvStorePath: 'MOCK_KVSTORE_PATH'
})
expect(btcSocketSpy).toHaveBeenCalledTimes(1)
expect(btcSocketSpy).toHaveBeenCalledWith(expect.any(Object), 'MOCK_WALLET_PATH', expect.any(Function))
expect(btcSocketSpy).toHaveBeenCalledWith(expect.any(Object))
expect(bchSocketSpy).toHaveBeenCalledTimes(1)
expect(bchSocketSpy).toHaveBeenCalledWith(expect.any(Object), 'MOCK_WALLET_PATH', expect.any(Function))
expect(bchSocketSpy).toHaveBeenCalledWith(expect.any(Object))
expect(ethSocketSpy).toHaveBeenCalledTimes(1)
expect(ethSocketSpy).toHaveBeenCalledWith(expect.any(Object), 'MOCK_WALLET_PATH', expect.any(Function))
expect(ethSocketSpy).toHaveBeenCalledWith(expect.any(Object))
expect(walletSyncSpy).toHaveBeenCalledTimes(1)
expect(walletSyncSpy).toHaveBeenCalledWith({
isAuthenticated: expect.any(Function),
Expand Down

0 comments on commit 286a4c2

Please sign in to comment.