Skip to content

Commit

Permalink
Merge pull request #1085 from prymitive/percy
Browse files Browse the repository at this point in the history
chore(ci): mock counters in storybook
  • Loading branch information
prymitive authored Oct 27, 2019
2 parents c158fd2 + 037370a commit 580fc28
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ui/src/Components/SilenceModal/index.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ storiesOf("SilenceModal", module)
</div>
</div>
))
.add("Silence Form", () => {
.add("Editor", () => {
const alertStore = new AlertStore([]);
const settingsStore = new Settings();
const silenceFormStore = new SilenceFormStore();
Expand All @@ -58,6 +58,21 @@ storiesOf("SilenceModal", module)

silenceFormStore.tab.current = SilenceTabNames.Editor;

fetchMock.mock(
"begin:/alerts.json?q=cluster",
{ totalAlerts: 0 },
{
overwriteRoutes: true
}
);
fetchMock.mock(
"begin:/alerts.json?q=instance",
{ totalAlerts: 23 },
{
overwriteRoutes: true
}
);

return (
<SilenceModalContent
alertStore={alertStore}
Expand Down Expand Up @@ -114,7 +129,9 @@ storiesOf("SilenceModal", module)
});
}

fetchMock.restore().mock("*", silences);
fetchMock.mock("begin:/silences.json?", silences, {
overwriteRoutes: true
});

return (
<SilenceModalContent
Expand Down

0 comments on commit 580fc28

Please sign in to comment.