mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#48: add account sorting
This commit is contained in:
@@ -56,13 +56,26 @@ describe('Accounts reducer', () => {
|
||||
token: 'newToken'
|
||||
};
|
||||
|
||||
return expect(
|
||||
expect(
|
||||
accounts({...initial, available: [outdatedAccount]}, add(updatedAccount)),
|
||||
'to satisfy', {
|
||||
available: [updatedAccount]
|
||||
});
|
||||
});
|
||||
|
||||
it('should sort accounts by username', () => {
|
||||
const newAccount = {
|
||||
...account,
|
||||
id: 2,
|
||||
username: 'abc'
|
||||
};
|
||||
|
||||
expect(accounts({...initial, available: [account]}, add(newAccount)),
|
||||
'to satisfy', {
|
||||
available: [newAccount, account]
|
||||
});
|
||||
});
|
||||
|
||||
it('throws, when account is invalid', () => {
|
||||
expect(() => accounts(initial, add()),
|
||||
'to throw', 'Invalid or empty payload passed for accounts.add');
|
||||
|
||||
Reference in New Issue
Block a user