Skip to content

Commit

Permalink
refactor(tests reflecting change in menu.component)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Sheppard<coolusername244@users.noreply.github.com>
  • Loading branch information
PalmN72 committed Nov 2, 2023
1 parent b500280 commit b6e61b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions apps/skolplattformen-app/components/__tests__/Menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jest.mock('@skolplattformen/hooks')

const defaultItemList = [
{
title: 'Måndag vecka 10',
title: 'Måndag',
description: 'Krämiga köttbullar',
},
{
title: 'Tisdag vecka 10',
title: 'Tisdag',
description: 'Kryddig falukorv',
},
{
title: 'Onsdag vecka 10',
title: 'Onsdag',
description: 'Sushi',
},
]
Expand All @@ -32,15 +32,15 @@ const setup = (itemList = defaultItemList) => {
test('renders multiple days', () => {
const screen = setup()

expect(screen.getByText('Måndag vecka 10')).toBeTruthy()
expect(screen.getByText('Tisdag vecka 10')).toBeTruthy()
expect(screen.getByText('Onsdag vecka 10')).toBeTruthy()
expect(screen.getByText('Måndag')).toBeTruthy()
expect(screen.getByText('Tisdag')).toBeTruthy()
expect(screen.getByText('Onsdag')).toBeTruthy()
})

test('renders title and description', () => {
const screen = setup()

expect(screen.getByText('Måndag vecka 10')).toBeTruthy()
expect(screen.getByText('Måndag')).toBeTruthy()
expect(screen.getByText('Krämiga köttbullar')).toBeTruthy()
})

Expand Down
2 changes: 1 addition & 1 deletion apps/skolplattformen-app/components/menu.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Menu = () => {
const styles = useStyleSheet(themedStyles)
const child = useChild()
const { data, status, reload } = useMenu(child)
const weekNr = data[0].title.split('Vecka')[1]
const weekNr = data[0]?.title.split('Vecka')[1] ?? '-'

return (
<>
Expand Down

0 comments on commit b6e61b2

Please sign in to comment.