Enhance Breadcrumbs (#39)
* chore(localization): remove duplicated locale files * feat(localization): add localization for breadcrumbs * feat(localization): add beadcrumb enhancements * feat(debugging): add npm run debug command * chore(localization): add unit tests * chore(breadcrumbs): fix tests and typos * chore(localization): add docs for translationAvailable * chore(localization): refactor translationAvailable
This commit is contained in:
committed by
GitHub
parent
a48fd1b63d
commit
81577c82fd
@@ -2,12 +2,18 @@
|
||||
const { getCourses, getCourse, getCoursesByCategory, getLesson } = require('../../routes/courses')
|
||||
const { getSettings } = require('../../routes/settings')
|
||||
const { mockCourse, mockCategory } = require('./mocks/index')
|
||||
const { translate, initializeTranslations } = require('../../i18n/i18n')
|
||||
const { translate, translationAvaliable, initializeTranslations } = require('../../i18n/i18n')
|
||||
|
||||
jest.mock('../../services/contentful')
|
||||
const contentful = require('../../services/contentful')
|
||||
|
||||
const request = {}
|
||||
const request = {
|
||||
app: {
|
||||
locals: {
|
||||
breadcrumb: []
|
||||
}
|
||||
}
|
||||
}
|
||||
const response = {
|
||||
locals: {
|
||||
settings: {
|
||||
@@ -104,4 +110,13 @@ describe('i18n', () => {
|
||||
test('It returns the translated string when symbol is found on locale file', () => {
|
||||
expect(translate('coursesLabel', 'en-US')).toBe('Courses')
|
||||
})
|
||||
test('It returns true if string is found for locale', () => {
|
||||
expect(translationAvaliable('coursesLabel', 'en-US')).toBe(true)
|
||||
})
|
||||
test('It returns false if string is not found for locale', () => {
|
||||
expect(translationAvaliable('foo-symbol', 'en-US')).toBe(false)
|
||||
})
|
||||
test('It returns false if locale is not found', () => {
|
||||
expect(translationAvaliable('coursesLabel', 'foo-locale')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user