mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
fix(tests): add missing coverage cases for LabelNameInput
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user