Lint and make App (Component) functional

This commit is contained in:
Nathan Barber
2021-04-07 15:36:17 -04:00
parent 1d705193cb
commit cadcb686c9
9 changed files with 82 additions and 123 deletions

View File

@@ -19,27 +19,27 @@ describe("AddUser Component: ", () => {
);
it("Renders", () => {
let component = shallow(addUserJsx(mockAsync()))
expect(component.find(".container").length).toBe(1)
})
let component = shallow(addUserJsx(mockAsync()));
expect(component.find(".container").length).toBe(1);
});
it("Removes users when they fail Regex", () => {
let callbackSpy = mockAsync(),
component = shallow(addUserJsx(callbackSpy)),
textarea = component.find("textarea").first()
textarea.simulate("blur", { target: { value: "foo\nbar\n!!*&*"}})
let submit = component.find("#submit")
submit.simulate("click")
expect(callbackSpy).toHaveBeenCalledWith(["foo", "bar"], false)
})
textarea = component.find("textarea").first();
textarea.simulate("blur", { target: { value: "foo\nbar\n!!*&*" } });
let submit = component.find("#submit");
submit.simulate("click");
expect(callbackSpy).toHaveBeenCalledWith(["foo", "bar"], false);
});
it("Correctly submits admin", () => {
let callbackSpy = mockAsync(),
component = shallow(addUserJsx(callbackSpy)),
input = component.find("input").first()
input.simulate("change", { target: { checked: true }})
let submit = component.find("#submit")
submit.simulate("click")
expect(callbackSpy).toHaveBeenCalledWith([], true)
})
input = component.find("input").first();
input.simulate("change", { target: { checked: true } });
let submit = component.find("#submit");
submit.simulate("click");
expect(callbackSpy).toHaveBeenCalledWith([], true);
});
});