Skip to content

Commit

Permalink
Test favorites more thoroughly
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Oct 16, 2024
1 parent ce3cb5e commit a0f88b7
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/components/__tests__/activityStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,26 +220,30 @@ describe('activityStore', () => {
expect(activityStore.favorites).toEqual(['cucumber']);
});

it('returns only ten favorites', () => {
activityStore.startDate = lastWeek;
it('returns only ten most common favorites', () => {
const expected = [
'wheat',
'rye',
'rice',
'apple',
'raspberry',
'cucumber',
'tomato',
'onion',
'garlic',
'endive',
];
activityStore.startDate = twoWeeksAgo;
activityStore.weeks.push({
veggies: [...expected, 'lettuce', 'broccoli', 'lychee'],
startDate: twoWeeksAgo,
});
activityStore.weeks.push({
veggies: [
'wheat',
'rye',
'rice',
'apple',
'raspberry',
'cucumber',
'tomato',
'onion',
'garlic',
'endive',
'lettuce',
],
veggies: [...expected, 'lettuce', 'barley'],
startDate: lastWeek,
});

expect(activityStore.favorites).toHaveLength(10);
expect(activityStore.favorites).toEqual(expected);
});

it('returns unique veggies', () => {
Expand Down

0 comments on commit a0f88b7

Please sign in to comment.