Skip to content

Commit

Permalink
add(jest): 100% coverage for store/accounts/getters.ts unit test (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
drepram authored and pavlzk committed Feb 4, 2022
1 parent 2f6cf06 commit 81f6bad
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions store/accounts/getters.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { AccountsState, RegistrationStatus } from './types'
import * as getters from '~/store/accounts/getters'

describe('init', () => {
let inst: any
const state: AccountsState = {
storePin: true,
loading: true,
locked: true,
pin: 'pin',
pinHash: 'pinHash',
active: 'active',
gasPrice: 'gasPrice',
phrase: 'phrase',
error: 'error',
encryptedPhrase: 'encryptedPhrase',
registered: true,
registrationStatus: RegistrationStatus.UNKNOWN,
lastVisited: 'lastVisited',
}

beforeEach(() => {
inst = getters.default
})

it('should retrieve pin hash', () => {
const result: any = inst.getPinHash(state)
expect(result).toEqual(state.pinHash)
})

it('should retrieve encrypted phrase', () => {
const result: any = inst.getEncryptedPhrase(state)
expect(result).toEqual(state.encryptedPhrase)
})

it('should retrieve phrase', () => {
const result: any = inst.getPhrase(state)
expect(result).toEqual(state.phrase)
})

it('should retrieve registration status', () => {
const result: any = inst.getRegistrationStatus(state)
expect(result).toEqual(state.registrationStatus)
})

it('should check if account is active', () => {
const result: any = inst.getActiveAccount(state)
expect(result).toEqual(state.active)
})
})

0 comments on commit 81f6bad

Please sign in to comment.