/** * Test Utils for reducers * * E.g. setJSONFixture('src/components/products/performance/ft-discrete-returns/lib/etf/mock-new-state-out.fixture.json', newState); */ /** * synchronously save JSON fixture file * @parameter {string} filename eg /components/products/pricing-distribution/ft-pricing-distribution/lib/gw/mock-new-state-out.fixture.json * @parameter {Object} obj file to stringify and store in file */ export function setJSONFixture(filename, obj) { const fs = require('fs'); fs.writeFileSync(filename, JSON.stringify(obj, null, ' ')); } /** * edit a object to remove undefineds and make flat * @parameter {Object} obj file to stringify and store in file * @return {Object} */ export function removeUndefineds(obj) { return JSON.parse(JSON.stringify(obj)); }