config#IS_TEST TypeScript Examples

The following examples show how to use config#IS_TEST. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: store.ts    From lightning-terminal with MIT License 6 votes vote down vote up
createStore = (grpcClient?: GrpcClient, appStorage?: AppStorage) => {
  const grpc = grpcClient || new GrpcClient();
  // Resolve api requests with sample data when running client in develop mode.
  grpc.useSampleData = USE_SAMPLE_DATA;

  const storage = appStorage || new AppStorage();
  const lndApi = new LndApi(grpc);
  const loopApi = new LoopApi(grpc);
  const poolApi = new PoolApi(grpc);
  const litApi = new LitApi(grpc);
  const csv = new CsvExporter();
  const history = createBrowserHistory();

  const store = new Store(
    lndApi,
    loopApi,
    poolApi,
    litApi,
    storage,
    history,
    csv,
    actionLog,
  );

  // initialize the store immediately to fetch API data, except when running unit tests
  if (!IS_TEST) store.init();

  // in dev env, make the store accessible via the browser DevTools console
  if (IS_DEV) (global as any).store = store;

  return store;
}
Example #2
Source File: batchStore.ts    From lightning-terminal with MIT License 6 votes vote down vote up
startPolling() {
    if (IS_TEST) return;
    if (this._pollingInterval) this.stopPolling();
    this._store.log.info('start polling for Pool data');
    // create timer to poll for new Pool data every minute
    this._pollingInterval = setInterval(async () => {
      this._store.log.info('polling for latest Pool data');
      await this.fetchLatestBatch();
      await this._store.accountStore.fetchAccounts();
      await this._store.orderStore.fetchOrders();
    }, (IS_DEV ? 15 : 60) * 1000);
  }