<commit_before>import { toggleWebAppBool } from "../actions";
import { BooleanSetting } from "../../session_keys";
import { edit, save } from "../../api/crud";
import { getWebAppConfig } from "../../resources/selectors";
import { fakeWebAppConfig } from "../../__test_support__/fake_state/resources";

jest.mock("../../api/crud", () => {
  return { save: jest.fn(), edit: jest.fn() };
});

const mockConfig = fakeWebAppConfig();
jest.mock("../../resources/selectors", () => {
  return {
    getWebAppConfig: () => mockConfig,
    assertUuid: jest.fn()
  };
});

describe("toggleWebAppBool", () => {
  it("toggles things", () => {
    const action = toggleWebAppBool(BooleanSetting.show_first_party_farmware);
    const dispatch = jest.fn();
    const getState = jest.fn(() => ({ resources: { index: {} } }));
    action(dispatch, getState);
    expect(edit).toHaveBeenCalledWith(mockConfig, {
      show_first_party_farmware: true
    });
    expect(save).toHaveBeenCalledWith(mockConfig.uuid);
  });
});
<commit_msg>remove unused import<commit_after>import { toggleWebAppBool } from "../actions";
import { BooleanSetting } from "../../session_keys";
import { edit, save } from "../../api/crud";
import { fakeWebAppConfig } from "../../__test_support__/fake_state/resources";

jest.mock("../../api/crud", () => {
  return { save: jest.fn(), edit: jest.fn() };
});

const mockConfig = fakeWebAppConfig();
jest.mock("../../resources/selectors", () => {
  return {
    getWebAppConfig: () => mockConfig,
    assertUuid: jest.fn()
  };
});

describe("toggleWebAppBool", () => {
  it("toggles things", () => {
    const action = toggleWebAppBool(BooleanSetting.show_first_party_farmware);
    const dispatch = jest.fn();
    const getState = jest.fn(() => ({ resources: { index: {} } }));
    action(dispatch, getState);
    expect(edit).toHaveBeenCalledWith(mockConfig, {
      show_first_party_farmware: true
    });
    expect(save).toHaveBeenCalledWith(mockConfig.uuid);
  });
});

{'fraction_non_alphanumeric': 0.198989898989899, 'fraction_numerical': 0.0, 'mean_word_length': 3.808252427184466, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7652859', 'n_tokens_mistral': 618, 'n_tokens_neox': 624, 'n_words': 110}