in src/utils/graphAPIUtils.js [209:235]
function graphAPIForE2ETest(
apiPath: string,
method: 'GET' | 'POST' | 'DELETE',
data: ?Object,
): Promise<Object> {
const key = stringify({apiPath, method, data});
return new Promise(resolve => {
const result = mockedCalls[key]
|| mockedCallsSimple[`${method}:${apiPath}`];
const latency = MOCK_API_LATENCY_MIN
+ Math.random() * (MOCK_API_LATENCY_MAX - MOCK_API_LATENCY_MIN);
setTimeout(() => {
if (mockedCallsDumpPath == null) {
winston.error('No API call expected for this E2E test.');
process.exit(1);
}
fs.appendFile(
mockedCallsDumpPath,
key + '\n',
{
encoding: 'utf8',
},
() => resolve(result),
);
}, latency);
});
}