<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';

import TestRenderer from 'react-test-renderer';
import Index from './index';

jest.mock('../../libs/assets');

const mockStore = configureStore([]);

const applicationId = '123';
const applicationInstanceId = '4847';

const store = mockStore({
  settings: {
    sign_out_url: 'https://www.example.com',
  },
  applicationInstances: {
    applicationInstances: [],
  },
  accounts: {
    accounts: {
      1234: {
        id: 1234,
        parent_account_id: null,
        name: 'paul',
      },
      2345: {
        id: 2345,
        parent_account_id: 1234,
        name: 'joe',
      },
      3456: {
        id: 3456,
        parent_account_id: 1234,
        name: 'bob',
      }
    }
  },
  applications: {},
  courses: [{}],
  applicationInstance: {},
  loadingCourses: {},
  loadingAccounts: false,
  sites: {},
});

describe('the index component', () => {
  let result;
  let instance;

  beforeEach(() => {
    result = TestRenderer.create(
      <Provider store={store}>
        <Index params={{
          applicationId,
          applicationInstanceId,
        }}
        />
      </Provider>
    );
    instance = result.root;
  });
  it('matches the snapshot', () => {
    expect(result).toMatchSnapshot();
  });

  it('sets the active account', () => {
    const buttons = instance.findAllByType('button');
    const button = buttons[1];
    const name = button.props.children[1];
    expect(name).toEqual('paul');
  });
});
<commit_msg>fixed test for lti_installs/index<commit_after>import React from 'react';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import TestRenderer from 'react-test-renderer';
import Index from './index';

jest.mock('../../libs/assets');
const mockStore = configureStore([]);
const applicationId = '123';
const applicationInstanceId = '4847';

const store = mockStore({
  settings: {
    sign_out_url: 'https://www.example.com',
  },
  applicationInstances: {
    applicationInstances: [],
  },
  accounts: {
    accounts: {
      1234: {
        id: 1234,
        parent_account_id: null,
        name: 'paul',
      },
      2345: {
        id: 2345,
        parent_account_id: 1234,
        name: 'joe',
      },
    }
  },
  applications: {},
  courses: [{}],
  applicationInstance: {},
  loadingCourses: {},
  loadingAccounts: false,
  sites: {},
});

describe('the index component', () => {
  let result;
  let instance;

  beforeEach(() => {
    result = TestRenderer.create(
      <Provider store={store}>
        <Index params={{
          applicationId,
          applicationInstanceId,
        }}
        />
      </Provider>
    );
    instance = result.root;
  });
  it('matches the snapshot', () => {
    expect(result).toMatchSnapshot();
  });

  it('sets the active account', () => {
    const buttons = instance.findAllByType('button');
    const button = buttons[1];
    const name = button.props.children[1];
    expect(name).toEqual('paul');
  });
});

{'fraction_non_alphanumeric': 0.15892342198013457, 'fraction_numerical': 0.02242870874719641, 'mean_word_length': 2.681603773584906, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4736890', 'n_tokens_mistral': 1006, 'n_tokens_neox': 962, 'n_words': 210}