fix(tests): add missing coverage cases for LabelNameInput

This commit is contained in:
Łukasz Mierzwa
2018-09-02 19:12:59 +01:00
parent 48f9176cf9
commit b5112880a5

View File

@@ -77,7 +77,7 @@ describe("<LabelNameInput />", () => {
}, 100);
});
it("suggestions are empited on failed fetch", done => {
it("suggestions are emptied on failed fetch", done => {
fetch.mockReject(new Error("fake error message"));
ShallowLabelNameInput();
// use timeout since mount will call fetch
@@ -86,4 +86,12 @@ describe("<LabelNameInput />", () => {
done();
}, 100);
});
it("doesn't fetch suggestions if value is changed to empty string", () => {
const tree = MountedLabelNameInput();
const instance = tree.instance();
const fetchSpy = jest.spyOn(instance, "populateValueSuggestions");
instance.onChange("");
expect(fetchSpy).not.toHaveBeenCalled();
});
});