mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 10:34:10 +00:00
Lint and make App (Component) functional
This commit is contained in:
@@ -9,26 +9,27 @@ describe("CreateGroup Component: ", () => {
|
||||
var mockAsync = () =>
|
||||
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
|
||||
|
||||
var createGroupJsx = (callbackSpy) =>
|
||||
var createGroupJsx = (callbackSpy) => (
|
||||
<CreateGroup
|
||||
createGroup={callbackSpy}
|
||||
refreshGroupsData={callbackSpy}
|
||||
history={{push: () => {}}}
|
||||
history={{ push: () => {} }}
|
||||
/>
|
||||
);
|
||||
|
||||
it("Renders", () => {
|
||||
let component = shallow(createGroupJsx())
|
||||
expect(component.find(".container").length).toBe(1)
|
||||
})
|
||||
let component = shallow(createGroupJsx());
|
||||
expect(component.find(".container").length).toBe(1);
|
||||
});
|
||||
|
||||
it("Calls createGroup and refreshGroupsData on submit", () => {
|
||||
let callbackSpy = mockAsync(),
|
||||
component = shallow(createGroupJsx(callbackSpy)),
|
||||
input = component.find("input").first(),
|
||||
submit = component.find("#submit").first()
|
||||
input.simulate("change", { target: { value: "" } })
|
||||
submit.simulate("click")
|
||||
expect(callbackSpy).toHaveBeenNthCalledWith(1, "")
|
||||
expect(callbackSpy).toHaveBeenNthCalledWith(2)
|
||||
})
|
||||
})
|
||||
submit = component.find("#submit").first();
|
||||
input.simulate("change", { target: { value: "" } });
|
||||
submit.simulate("click");
|
||||
expect(callbackSpy).toHaveBeenNthCalledWith(1, "");
|
||||
expect(callbackSpy).toHaveBeenNthCalledWith(2);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user