-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests to work when untranslated items are hidden
- Loading branch information
1 parent
910cf1a
commit fe88bc4
Showing
5 changed files
with
67 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
import { getSubTaskGroupsOrTasksText } from './index' | ||
|
||
const language = 'fi' | ||
|
||
const taskGroup = { | ||
guid: '1234', | ||
tasks: [{ guid: '1' }, { guid: '2' }, { guid: '3' }], | ||
taskgroups: [{ guid: '4' }, { guid: '5' }, { guid: '6' }], | ||
languages: [{ lang: language, title: 'Sudenpennut' }], | ||
} | ||
|
||
const translated = { | ||
tasks: [{ guid: '1' }, { guid: '2' }], | ||
subGroups: [{ guid: '4' }, { guid: '5' }], | ||
} | ||
|
||
const itemsByGuid = { | ||
'1234': taskGroup, | ||
} | ||
|
||
const taskGroupItemProps = { | ||
taskGroup: { | ||
guid: '1234', | ||
tasks: [{ guid: '1' }, { guid: '2' }, { guid: '3' }], | ||
taskgroups: [{ guid: '4' }, { guid: '5' }, { guid: '6' }], | ||
languages: [{ lang: 'fi', title: 'Sudenpennut' }], | ||
}, | ||
taskGroup, | ||
ageGroupIndex: 2, | ||
language: 'sv', | ||
language, | ||
tasksTerm: 'askelta', | ||
} | ||
|
||
describe('TaskGroupItem component', () => { | ||
it('renders the amounts of given subTaskGroups and tasks', () => { | ||
const text = getSubTaskGroupsOrTasksText( | ||
taskGroupItemProps.tasksTerm, | ||
taskGroupItemProps.taskGroup | ||
taskGroupItemProps.taskGroup, | ||
language, | ||
itemsByGuid, | ||
translated | ||
) | ||
expect(text).toBe( | ||
`${taskGroupItemProps.taskGroup.tasks.length} + ${taskGroupItemProps.taskGroup.taskgroups.length} ${taskGroupItemProps.tasksTerm}` | ||
`${translated.tasks.length} + ${translated.subGroups.length} ${taskGroupItemProps.tasksTerm}` | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters