61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
/* global jest: true */
|
|
// https://github.com/react-native-community/react-native-localize/blob/master/README.md#how-to-test-your-code
|
|
const getLocales = () => [
|
|
// you can choose / add the locales you want
|
|
{
|
|
countryCode: 'US',
|
|
languageTag: 'en',
|
|
languageCode: 'en',
|
|
isRTL: false,
|
|
},
|
|
{
|
|
countryCode: 'DE',
|
|
languageTag: 'de',
|
|
languageCode: 'de',
|
|
isRTL: false,
|
|
},
|
|
{
|
|
countryCode: 'JA',
|
|
languageTag: 'ja',
|
|
languageCode: 'ja',
|
|
isRTL: false,
|
|
},
|
|
];
|
|
|
|
// use a provided translation, or return undefined to test your fallback
|
|
const findBestAvailableLanguage = () => ({
|
|
languageTag: 'en',
|
|
isRTL: false,
|
|
});
|
|
|
|
const getNumberFormatSettings = () => ({
|
|
decimalSeparator: '.',
|
|
groupingSeparator: ',',
|
|
});
|
|
|
|
const getCalendar = () => 'gregorian'; // or 'japanese', 'buddhist'
|
|
const getCountry = () => 'US'; // the country code you want
|
|
const getCurrencies = () => ['USD', 'EUR']; // can be empty array
|
|
const getTemperatureUnit = () => 'celsius'; // or 'fahrenheit'
|
|
const getTimeZone = () => 'Europe/Paris'; // the timezone you want
|
|
const uses24HourClock = () => true;
|
|
const usesMetricSystem = () => true;
|
|
|
|
const addEventListener = jest.fn();
|
|
const removeEventListener = jest.fn();
|
|
|
|
export {
|
|
findBestAvailableLanguage,
|
|
getLocales,
|
|
getNumberFormatSettings,
|
|
getCalendar,
|
|
getCountry,
|
|
getCurrencies,
|
|
getTemperatureUnit,
|
|
getTimeZone,
|
|
uses24HourClock,
|
|
usesMetricSystem,
|
|
addEventListener,
|
|
removeEventListener,
|
|
};
|