Tests for doToggle()
This commit is contained in:
parent
3e7d1ca1b9
commit
3905c7ee1d
|
@ -1,6 +1,19 @@
|
|||
jest.mock("../../config_storage/actions", () => {
|
||||
return {
|
||||
toggleWebAppBool: jest.fn(() => "IT WORKS")
|
||||
};
|
||||
});
|
||||
|
||||
import { doToggle } from "../index";
|
||||
import { toggleWebAppBool } from "../../config_storage/actions";
|
||||
|
||||
describe("doToggle()", () => {
|
||||
it("calls toggleWebAppBool, but isolated from its parent", () => {
|
||||
const dispatch = jest.fn();
|
||||
const toggler = doToggle(dispatch);
|
||||
const key = "show_first_party_farmware";
|
||||
toggler(key);
|
||||
expect(toggleWebAppBool).toHaveBeenCalledWith(key);
|
||||
expect(dispatch).toHaveBeenCalledWith("IT WORKS");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue