mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
feat(ci): mock silence fetches in storybook
This commit is contained in:
28
ui/package-lock.json
generated
28
ui/package-lock.json
generated
@@ -8159,6 +8159,34 @@
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
},
|
||||
"fetch-mock": {
|
||||
"version": "8.0.0-alpha.5",
|
||||
"resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-8.0.0-alpha.5.tgz",
|
||||
"integrity": "sha512-/FShpzvtDt/535q+9un5Ve+GGNsCKX3AW9CQN5htZ2eLY11E7yM///SrXoK8QteETSnKbT2N0vyHHIiRcVi7/A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"babel-runtime": "^6.26.0",
|
||||
"core-js": "^3.0.0",
|
||||
"glob-to-regexp": "^0.4.0",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"path-to-regexp": "^2.2.1",
|
||||
"whatwg-url": "^6.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob-to-regexp": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
|
||||
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
|
||||
"dev": true
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
|
||||
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"figgy-pudding": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz",
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
"enzyme": "3.10.0",
|
||||
"enzyme-adapter-react-16": "1.15.1",
|
||||
"eslint-plugin-prettier": "3.1.1",
|
||||
"fetch-mock": "8.0.0-alpha.5",
|
||||
"jest-canvas-mock": "2.1.2",
|
||||
"jest-date-mock": "1.0.7",
|
||||
"jest-fetch-mock": "2.1.2",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import React from "react";
|
||||
|
||||
import fetchMock from "fetch-mock";
|
||||
|
||||
import { storiesOf } from "@storybook/react";
|
||||
|
||||
import { MockSilence } from "__mocks__/Alerts";
|
||||
@@ -93,6 +95,8 @@ storiesOf("SilenceModal", module)
|
||||
let silences = [];
|
||||
for (var index = 1; index <= 18; index++) {
|
||||
const silence = MockSilence();
|
||||
silence.startsAt = "2018-08-14T16:00:00Z";
|
||||
silence.endsAt = `2018-08-14T18:${index < 10 ? "0" + index : index}:00Z`;
|
||||
silence.id = `silence${index}`;
|
||||
silences.push({
|
||||
cluster: "am",
|
||||
@@ -100,6 +104,8 @@ storiesOf("SilenceModal", module)
|
||||
});
|
||||
}
|
||||
|
||||
fetchMock.restore().mock("*", silences);
|
||||
|
||||
return (
|
||||
<SilenceModalContent
|
||||
alertStore={alertStore}
|
||||
|
||||
Reference in New Issue
Block a user