<commit_before>import * as React from 'react';
import TestRenderer from 'react-test-renderer';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
const { shallow } = Enzyme;

import {
  OPTIONS_TEXT,
  INITIAL_OPTIONS,
  SHOW_ON_TIMELINE,
  isFalse,
  SHOW_ON_TWEETDECK_TIMELINE,
  isTrue,
} from '../src/helpers/Constants';
import { Popup } from '../src/popup';

describe('Popup', () => {
  it('render', () => {
    const optionsText = OPTIONS_TEXT;
    const optionKeys = Object.keys(INITIAL_OPTIONS);
    const optionsEnabled = {};
    optionKeys.forEach(key => {
      optionsEnabled[key] = true;
    });

    const props = {
      optionsText,
      optionKeys,
      optionsEnabled,
    };
    const tree = TestRenderer.create(<Popup {...props} />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  describe('保存ボタン押すと設定が保存される', () => {
    window.localStorage = {};
    expect(window.localStorage).toMatchObject({});

    const optionsText = OPTIONS_TEXT;
    const optionKeys = Object.keys(INITIAL_OPTIONS);
    const optionsEnabled = {};
    const expectOptions = {};
    optionKeys.forEach(key => {
      optionsEnabled[key] = true;
      expectOptions[key] = isTrue;
    });<commit_msg>fix tests for popup<commit_after>import * as React from 'react';
import TestRenderer from 'react-test-renderer';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
const { shallow } = Enzyme;

import {
  OPTIONS_TEXT,
  SHOW_ON_TIMELINE,
  isFalse,
  SHOW_ON_TWEETDECK_TIMELINE,
  isTrue,
  OPTION_KEYS,
} from '../src/main';
import { Popup } from '../src/popup';

describe('Popup', () => {
  it('render', () => {
    const optionsText = OPTIONS_TEXT;
    const optionKeys = OPTION_KEYS;
    const optionsEnabled = {};
    optionKeys.forEach(key => {
      optionsEnabled[key] = true;
    });

    const props = {
      optionsText,
      optionKeys,
      optionsEnabled,
    };
    const tree = TestRenderer.create(<Popup {...props} />).toJSON();
    expect(tree).toMatchSnapshot();
  });

  describe('保存ボタン押すと設定が保存される', () => {
    window.localStorage = {};
    expect(window.localStorage).toMatchObject({});

    const optionsText = OPTIONS_TEXT;
    const optionKeys = OPTION_KEYS;
    const optionsEnabled = {};
    const expectOptions = {};
    optionKeys.forEach(key => {
      optionsEnabled[key] = true;
      expectOptions[key] = isTrue;
    });
{'fraction_non_alphanumeric': 0.14605842336934774, 'fraction_numerical': 0.001600640256102441, 'mean_word_length': 3.488330341113106, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4475946', 'n_tokens_mistral': 832, 'n_tokens_neox': 812, 'n_words': 161}