Skip to content

Commit

Permalink
test(filter-validation): use typed factory in test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
YLeight committed Jan 24, 2024
1 parent 0b3e6f7 commit 423af48
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/people/utils/__test__/filterValidation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CodingLanguageFilterFactory } from 'hooks/usePeopleFilters';
import { bountyHeaderFilter, bountyHeaderLanguageFilter } from '../filterValidation';
import filterByCodingLanguage from '../filterPeople';
import { users } from '../__test__/__mockData__/users';
Expand Down Expand Up @@ -51,19 +52,19 @@ describe('testing filters', () => {
});
describe('peopleHeaderCodingLanguageFilters', () => {
test('match', () => {
expect(filterByCodingLanguage(users, { Typescript: true })).toStrictEqual([users[0]]);
expect(filterByCodingLanguage(users, CodingLanguageFilterFactory('Typescript'))).toStrictEqual([users[0]]);
});
test('no_match', () => {
expect(filterByCodingLanguage(users, { Rust: true })).toStrictEqual([]);
expect(filterByCodingLanguage(users, CodingLanguageFilterFactory('Rust'))).toStrictEqual([]);
});
test('no filters', () => {
expect(filterByCodingLanguage(users, {})).toEqual(users);
expect(filterByCodingLanguage(users, CodingLanguageFilterFactory())).toEqual(users);
});
test('false filters', () => {
expect(filterByCodingLanguage(users, { PHP: false, MySQL: false })).toStrictEqual(users);
expect(filterByCodingLanguage(users, CodingLanguageFilterFactory('PHP', 'MySQL'))).toStrictEqual(users);
});
test('no users', () => {
expect(filterByCodingLanguage([], { Typescript: true })).toStrictEqual([]);
expect(filterByCodingLanguage([], CodingLanguageFilterFactory('Typescript'))).toStrictEqual([]);
});
});
});

0 comments on commit 423af48

Please sign in to comment.