mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-13 13:03:01 +00:00
Reconfigure tests to work with hook approach
This commit is contained in:
@@ -18,31 +18,10 @@ describe("EditUser Component: ", () => {
|
||||
refreshUserData={mockSync()}
|
||||
history={{ push: (a) => {} }}
|
||||
failRegexEvent={callbackSpy}
|
||||
noChangeEvent={callbackSpy}
|
||||
/>
|
||||
);
|
||||
|
||||
it("Updates the state whenever a key is pressed on the textarea", () => {
|
||||
let component = shallow(editUserJsx(mockAsync())),
|
||||
textarea = component.find("textarea");
|
||||
textarea.simulate("keydown", { target: { value: "test" } });
|
||||
expect(component.state("updated_username")).toBe("test");
|
||||
});
|
||||
|
||||
it("Updates the state whenever the admin box changes", () => {
|
||||
let component = shallow(editUserJsx(mockAsync())),
|
||||
admin = component.find("#admin-check");
|
||||
admin.simulate("change", { target: { checked: true } });
|
||||
expect(component.state("admin")).toBe(true);
|
||||
});
|
||||
|
||||
it("Delimits the input from the textarea", () => {
|
||||
let component = shallow(editUserJsx(mockAsync())),
|
||||
submit = component.find("#submit");
|
||||
component.setState({ updated_username: "%!@$#&" });
|
||||
submit.simulate("click");
|
||||
expect(component.state("updated_username")).toBe("");
|
||||
});
|
||||
|
||||
it("Calls the delete user function when the button is pressed", () => {
|
||||
let callbackSpy = mockAsync(),
|
||||
component = shallow(editUserJsx(callbackSpy)),
|
||||
@@ -52,11 +31,9 @@ describe("EditUser Component: ", () => {
|
||||
});
|
||||
|
||||
it("Submits the edits when the button is pressed", () => {
|
||||
let callbackSpy = mockAsync(),
|
||||
let callbackSpy = mockSync(),
|
||||
component = shallow(editUserJsx(callbackSpy)),
|
||||
submit = component.find("#submit"),
|
||||
textarea = component.find("textarea");
|
||||
textarea.simulate("keydown", { target: { value: "test" } });
|
||||
submit = component.find("#submit");
|
||||
submit.simulate("click");
|
||||
expect(callbackSpy).toHaveBeenCalled();
|
||||
});
|
||||
|
Reference in New Issue
Block a user