<commit_before>// @flow weak
/* eslint-env mocha */

import React from 'react';
import { assert } from 'chai';
import { createShallowWithContext, createMountWithContext } from 'test/utils';
import { createSwitch, styleSheet } from './SwitchBase';

describe('<SwitchBase />', () => {
  let shallow;
  let classes;
  let mount;
  let SwitchBase;

  before(() => {
    SwitchBase = createSwitch();
    shallow = createShallowWithContext();
    mount = createMountWithContext();
    classes = shallow.context.styleManager.render(styleSheet);
  });
  after(() => mount.cleanUp());

  it('should render an IconButton', () => {
    const wrapper = shallow(
      <SwitchBase />,
    );
    assert.strictEqual(wrapper.is('IconButton'), true, 'should be an IconButton');
  });

  it('should render an icon and input inside the button by default', () => {
    const wrapper = shallow(
      <SwitchBase />,
    );
    assert.strictEqual(wrapper.childAt(0).is('CheckBoxOutlineBlank'), true, 'should be an SVG icon');
    assert.strictEqual(wrapper.childAt(1).is('input[type="checkbox"]'), true, 'should be a checkbox input');
  });

  // IT SHOULD RENDER
  // WITH A CUSTOM ICON!!!

  // className is put on the root node, this is a special case!<commit_msg>Fix SwitchBase default icon test<commit_after>// @flow weak
/* eslint-env mocha */

import React from 'react';
import { assert } from 'chai';
import { createShallowWithContext, createMountWithContext } from 'test/utils';
import { createSwitch, styleSheet } from './SwitchBase';

describe('<SwitchBase />', () => {
  let shallow;
  let classes;
  let mount;
  let SwitchBase;

  before(() => {
    SwitchBase = createSwitch();
    shallow = createShallowWithContext();
    mount = createMountWithContext();
    classes = shallow.context.styleManager.render(styleSheet);
  });
  after(() => mount.cleanUp());

  it('should render an IconButton', () => {
    const wrapper = shallow(
      <SwitchBase />,
    );
    assert.strictEqual(wrapper.is('IconButton'), true, 'should be an IconButton');
  });

  it('should render an icon and input inside the button by default', () => {
    const wrapper = shallow(
      <SwitchBase />,
    );
    assert.strictEqual(wrapper.childAt(0).is('pure(CheckBoxOutlineBlank)'), true, 'should be an SVG icon');
    assert.strictEqual(wrapper.childAt(1).is('input[type="checkbox"]'), true, 'should be a checkbox input');
  });

  // IT SHOULD RENDER
  // WITH A CUSTOM ICON!!!

  // className is put on the root node, this is a special case!
{'fraction_non_alphanumeric': 0.15085351329892815, 'fraction_numerical': 0.0015879317189360857, 'mean_word_length': 3.781783681214421, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '7534722', 'n_tokens_mistral': 756, 'n_tokens_neox': 738, 'n_words': 213}