1const path = require('path'); 2 3const testDirectory = `__tests__`; 4module.exports = (platform) => { 5 const customPath = path.join(testDirectory, '__snapshots__'); 6 const getExt = (ext) => `${ext}.${platform}`; 7 return { 8 resolveSnapshotPath: (testPath, snapshotExtension) => { 9 const snapshotFilePath = 10 testPath.replace(testDirectory, customPath) + getExt(snapshotExtension); 11 return snapshotFilePath; 12 }, 13 14 resolveTestPath: (snapshotFilePath, snapshotExtension) => { 15 const testPath = snapshotFilePath 16 .replace(customPath, testDirectory) 17 .slice(0, -getExt(snapshotExtension).length); 18 return testPath; 19 }, 20 21 testPathForConsistencyCheck: path.posix.join( 22 'consistency_check', 23 testDirectory, 24 'example.test.js' 25 ), 26 }; 27}; 28