Skip to content

Instantly share code, notes, and snippets.

@alvinslee
Created February 4, 2021 17:42
Show Gist options
  • Save alvinslee/8971f6b1dc3877b223528bd92a472685 to your computer and use it in GitHub Desktop.
Save alvinslee/8971f6b1dc3877b223528bd92a472685 to your computer and use it in GitHub Desktop.
A module for preparing test data - with code duplication removed
const {
addTimestamps,
truncateLocations
} = require('./testHelpers')
const KEYS = [
'userData',
'deviceTypes',
'nutritionPlans',
'exerciseRoutine',
'goals',
'miniChallenges',
'rewards'
]
export function prepare() => {
const result = {}
for (const key of KEYS) {
result[key] = require(`./testData/${key}.json`)
truncateLocations(result[key])
addTimestamps(result[key])
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment