Skip to content

Commit

Permalink
fix: Add selector test
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia committed Oct 2, 2023
1 parent f3b29f9 commit 0f16ea5
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/modules/worlds/selectors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import { RootState } from 'modules/common/types'
import { INITIAL_STATE } from './reducer'
import { getData, getError, getLoading, getState, getWalletStats } from './selectors'
import { getConnectedWalletStats, getData, getError, getLoading, getState, getWalletStats } from './selectors'

let connectedWallet: string
let state: RootState

beforeEach(() => {
connectedWallet = '0x123'

state = {
worlds: INITIAL_STATE
worlds: { ...INITIAL_STATE, walletStats: { [connectedWallet]: {} } },
wallet: {
data: {
address: connectedWallet
}
}
} as RootState
})

Expand Down Expand Up @@ -39,3 +47,9 @@ describe('when getting the worlds wallet stats', () => {
expect(getWalletStats(state)).toEqual(state.worlds.walletStats)
})
})

describe('when getting the worlds wallet stats for the connected wallet', () => {
it('should return the worlds wallet stats for the connected wallet', () => {
expect(getConnectedWalletStats(state)).toEqual(state.worlds.walletStats[connectedWallet])
})
})

0 comments on commit 0f16ea5

Please sign in to comment.