function setupE2E()

in src/utils/graphAPIUtils.js [237:269]


function setupE2E(config: {
  mockedCalls?: ?Array<{
    params: {
      apiPath: string,
      method: 'GET' | 'POST' | 'DELETE',
      data: ?Object,
    },
    result: any,
  }>,
  mockedCallsSimple?: ?Array<{
    params: {
      apiPath: string,
      method: 'GET' | 'POST' | 'DELETE',
    },
    result: any,
  }>,
  mockedCallsDumpPath?: ?string,
}): void {
  (config.mockedCalls || []).forEach(call => {
    mockedCalls[stringify(call.params)] = call.result;
  });
  (config.mockedCallsSimple || []).forEach(call => {
    mockedCallsSimple[`${call.params.method}:${call.params.apiPath}`] =
      call.result;
  });
  if (config.mockedCallsDumpPath != null) {
    mockedCallsDumpPath = path.resolve(config.mockedCallsDumpPath);
    // eslint-disable-next-line no-useless-concat
    fs.writeFileSync(mockedCallsDumpPath, '@' + 'generated\n');
  }
  isE2E = true;
  apiImpl = graphAPIForE2ETest;
}