2019-04-06 22:08:29 +09:00
|
|
|
import Account, { AccountState, MUTATION_TYPES } from '@/store/Preferences/Account'
|
2019-06-06 23:44:50 +09:00
|
|
|
import { LocalAccount } from '~/src/types/localAccount'
|
2019-04-06 22:08:29 +09:00
|
|
|
|
2019-04-14 23:21:08 +09:00
|
|
|
const account: LocalAccount = {
|
2019-04-06 22:08:29 +09:00
|
|
|
_id: 'sample',
|
|
|
|
baseURL: 'http://example.com',
|
|
|
|
domain: 'example.com',
|
|
|
|
clientId: 'hoge',
|
|
|
|
clientSecret: 'hogehoge',
|
|
|
|
accessToken: null,
|
|
|
|
refreshToken: null,
|
|
|
|
username: null,
|
|
|
|
accountId: null,
|
|
|
|
avatar: null,
|
|
|
|
order: 1
|
|
|
|
}
|
2018-12-29 15:38:29 +09:00
|
|
|
|
|
|
|
describe('Preferences/Account', () => {
|
|
|
|
describe('mutations', () => {
|
2019-04-06 22:08:29 +09:00
|
|
|
let state: AccountState
|
2018-12-29 15:38:29 +09:00
|
|
|
beforeEach(() => {
|
|
|
|
state = {
|
|
|
|
accounts: [],
|
|
|
|
accountLoading: false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
describe('updateAccounts', () => {
|
|
|
|
it('should be updated', () => {
|
2019-04-06 22:08:29 +09:00
|
|
|
Account.mutations![MUTATION_TYPES.UPDATE_ACCOUNTS](state, [account])
|
|
|
|
expect(state.accounts).toEqual([account])
|
2018-12-29 15:38:29 +09:00
|
|
|
})
|
|
|
|
})
|
|
|
|
describe('updateAccountLoading', () => {
|
|
|
|
it('should be update', () => {
|
2019-04-06 22:08:29 +09:00
|
|
|
Account.mutations![MUTATION_TYPES.UPDATE_ACCOUNT_LOADING](state, true)
|
2018-12-29 15:38:29 +09:00
|
|
|
expect(state.accountLoading).toEqual(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|