Skip to content

Commit

Permalink
Allow undefined to be passed to account filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Torgeir Pedersen Cook committed Jul 26, 2016
1 parent 35d2f1d commit cc695e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/account-filter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function accountFilter(query) {
export default function accountFilter(query = '') {
const nameQuery = query.toLowerCase();
const accountNumberQuery = query.replace(/[ .]/g, '');

Expand Down
4 changes: 4 additions & 0 deletions src/account-filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ describe('accountFilter', () => {
assert.deepEqual(accounts.filter(accountFilter('')), accounts);
});

it('should not filter with undefined query', () => {
assert.deepEqual(accounts.filter(accountFilter(undefined)), accounts);
});

it('should filter by name', () => {
assert.deepEqual(accounts.filter(accountFilter('Matvererkonto')), [accounts[1]]);
});
Expand Down

0 comments on commit cc695e8

Please sign in to comment.