<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import fetchMock from 'fetch-mock/es5/client';
import LoginActivityPage from './LoginActivityPage';
import loginActivityJson from './loginActivityJson.fixture';

function mockFetch(props = {}) {
  fetchMock.restore();

  const {queryStartTimestamp, queryEndTimestamp} = props;
  const url = `/api/login_activity?created_at_or_before=${queryEndTimestamp}&created_after=${queryStartTimestamp}`;
  fetchMock.get(url, loginActivityJson);
}

function testProps(props = {}) {
  return {
    queryStartTimestamp: '1529513716',
    queryEndTimestamp: '1532105716',
    ...props
  };
}

it('renders without crashing', () => {
  const props = testProps();
  mockFetch(props);
  const el = document.createElement('div');
  ReactDOM.render(<LoginActivityPage {...props} />, el);
});

it('renders after fetching', done => {
  const props = testProps();
  mockFetch(props);
  const el = document.createElement('div');
  ReactDOM.render(<LoginActivityPage {...props} />, el);

  setTimeout(() => {
    expect(el.innerHTML).toContain('Login Attempts, Past 30 days');
    expect(el.querySelectorAll('div.tooltip').length).toEqual(47);
    done();
  }, 0);
});<commit_msg>Add debug log in test<commit_after>import React from 'react';
import ReactDOM from 'react-dom';
import fetchMock from 'fetch-mock/es5/client';
import LoginActivityPage from './LoginActivityPage';
import loginActivityJson from './loginActivityJson.fixture';

function mockFetch(props = {}) {
  fetchMock.restore();

  const {queryStartTimestamp, queryEndTimestamp} = props;
  const url = `/api/login_activity?created_at_or_before=${queryEndTimestamp}&created_after=${queryStartTimestamp}`;
  fetchMock.get(url, loginActivityJson);
}

function testProps(props = {}) {
  return {
    queryStartTimestamp: '1529513716',
    queryEndTimestamp: '1532105716',
    ...props
  };
}

it('renders without crashing', () => {
  const props = testProps();
  mockFetch(props);
  const el = document.createElement('div');
  ReactDOM.render(<LoginActivityPage {...props} />, el);
});

it('renders after fetching', done => {
  const props = testProps();
  mockFetch(props);
  const el = document.createElement('div');
  ReactDOM.render(<LoginActivityPage {...props} />, el);

  setTimeout(() => {
    expect(el.innerHTML).toContain('Login Attempts, Past 30 days');
    expect(el.querySelectorAll('div.tooltip').length).toEqual(47);
    console.log('debug:', el.innerHTML); // eslint-disable-line no-console
    done();
  }, 0);
});
{'fraction_non_alphanumeric': 0.16044042469524183, 'fraction_numerical': 0.020448289421942586, 'mean_word_length': 5.071599045346062, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6888264', 'n_tokens_mistral': 798, 'n_tokens_neox': 771, 'n_words': 160}