diff --git a/ui/src/Components/SilenceModal/LabelNameInput.test.js b/ui/src/Components/SilenceModal/LabelNameInput.test.js
index dbcc8934e..6af967fd4 100644
--- a/ui/src/Components/SilenceModal/LabelNameInput.test.js
+++ b/ui/src/Components/SilenceModal/LabelNameInput.test.js
@@ -77,7 +77,7 @@ describe("", () => {
}, 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("", () => {
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();
+ });
});