-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add(jest): 100% coverage for store/accounts/getters.ts unit test (#1297)
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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) | ||
}) | ||
}) |