Add compareUsers test

This commit is contained in:
Ken-Håvard Lieng 2017-07-06 07:01:14 +02:00
parent 8b44f68231
commit a4a4588ae6
1 changed files with 25 additions and 0 deletions

View File

@ -291,3 +291,28 @@ function socket_mode(server, channel, user, add, remove) {
server, channel, user, add, remove server, channel, user, add, remove
}; };
} }
describe('compareUsers()', () => {
it('compares users correctly', () => {
const compareUsers = reducer.__get__('compareUsers');
expect([
{ renderName: 'user5' },
{ renderName: '@user2' },
{ renderName: 'user3' },
{ renderName: 'user2' },
{ renderName: '+user1' },
{ renderName: '~bob' },
{ renderName: '%apples' },
{ renderName: '&cake' }
].sort(compareUsers)).toEqual([
{ renderName: '~bob' },
{ renderName: '&cake' },
{ renderName: '@user2' },
{ renderName: '%apples' },
{ renderName: '+user1' },
{ renderName: 'user2' },
{ renderName: 'user3' },
{ renderName: 'user5' }
]);
});
});