R.converge( (text, tags, references) => ({ text, tags, references, children: [] }), [ parseText, parseTags, R.pipe( R.replace(tagsRegex, ''), parseMentions ) ] )
// Mock your external modules here if needed jest .mock('react-native-i18n', () => { const english = require('../App/I18n/languages/english.json') const keys = require('ramda') const replace = require('ramda') const forEach = require('ramda') return { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } } })
/** * Gets the list of plugins. * * @param toolbox The toolbox * @param plugins The plugins holding the commands * @param commandRoot Optional, only show commands with this root * @return List of plugins. */ export function commandInfo(toolbox: IToolbox, commandRoot?: string[]): string[][] { return pipe( reject(isHidden), reject(command => { if (!commandRoot) { return false } return !equals(command.commandPath.slice(0, commandRoot.length), commandRoot) }), map(command => { const alias = command.hasAlias() ? `(${command.aliases.join(', ')})` : '' return [ `${command.commandPath.join(' ')} ${alias}`, replace('$BRAND', toolbox.runtime.brand, command.description || '-'), ] }), )(toolbox.runtime.commands) }
// Mock i18n as it uses react native stuff // This mock returns the interpolated text from the english.json file in App/I18n // If you are not using '../App/I18n/english.json' for your I18n values, simply replace import english // with the import at the top of this file from '../App/I18n/english.json' with the I18n json file you // want to use, such as "import french from '../App/I18n/fr.json'" and set 'let value = french[key]` mockery.registerMock('react-native-i18n', { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } })
jest .mock('react-native-device-info', () => { return { isTablet: jest.fn(() => { return false }) } }) .mock('react-native-i18n', () => { const english = require('../App/I18n/languages/english.json') const keys = require('ramda') const replace = require('ramda') const forEach = require('ramda') return { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } } })
R.concat(R.__, '/'), R.concat(R.__, slug), R.replace('//', '/') )(path)
if (slug) { childPath = R.pipe(R.concat(R.__, '/'), R.concat(R.__, slug), R.replace('//', '/'))(path);
R.converge(function (text, tags, references) { return { text: text, tags: tags, references: references, children: [] }; }, [parseText, parseTags, R.pipe(R.replace(tagsRegex, ''), parseMentions)])
// Mock i18n as it uses react native stuff // This mock returns the interpolated text from the english.json file in App/I18n // If you are not using '../App/I18n/english.json' for your I18n values, simply replace import english // with the import at the top of this file from '../App/I18n/english.json' with the I18n json file you // want to use, such as "import french from '../App/I18n/fr.json'" and set 'let value = french[key]` mockery.registerMock('react-native-i18n', { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } })
// Mock i18n as it uses react native stuff // This mock returns the interpolated text from the english.json file in App/I18n // If you are not using '../App/I18n/english.json' for your I18n values, simply replace import english // with the import at the top of this file from '../App/I18n/english.json' with the I18n json file you // want to use, such as "import french from '../App/I18n/fr.json'" and set 'let value = french[key]` mockery.registerMock('react-native-i18n', { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } })
// Mock your external modules here if needed jest .mock('react-native-i18n', () => { const english = require('../App/I18n/languages/english.json') const keys = require('ramda') const replace = require('ramda') const forEach = require('ramda') return { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } } })
// Mock your external modules here if needed jest .mock('react-native-i18n', () => { const english = require('../App/I18n/languages/english.json') const keys = require('ramda') const replace = require('ramda') const forEach = require('ramda') return { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value } } })
/* eslint-disable global-require */ jest .mock('react-native-device-info', () => ({ isTablet: jest.fn(() => false) })) .mock('react-native-i18n', () => { const english = require('../App/I18n/languages/english.json') const keys = require('ramda') const replace = require('ramda') const forEach = require('ramda') return { t: (key, replacements) => { let value = english[key] if (!value) return key if (!replacements) return value forEach((r) => { value = replace(`{{${r}}}`, replacements[r], value) }, keys(replacements)) return value }, } })