Files
iNaturalistReactNative/tests/factory.js
Amanda Bullington 0d69fe1568 Fetch user locale from server and change language (#255)
* Fetch user from server, set locale in realm and change language with i18next
* Added some Spanish translations so I can see localization working
* config QueryClient with `cacheTime: Infinity` to deal with "Jest did not
  exit" errors

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-12-09 15:51:17 -08:00

23 lines
685 B
JavaScript

import factory from "factoria";
import fs from "fs";
import path from "path";
// Require each individual factory definition, not to use the export but just
// to register them with factoria
const pathToFactories = path.join( __dirname, "factories" );
fs.readdirSync( pathToFactories ).forEach( file => {
const factoryName = path.basename( file, ".js" );
// eslint-disable-next-line global-require, import/no-dynamic-require
require( `./factories/${factoryName}` );
} );
// Makes a basic API response from an array of results
export const makeResponse = ( results = [] ) => ( {
total_results: results.length,
page: 1,
per_page: 30,
results
} );
export default factory;