UNPKG

@grafana/alerting

Version:

Grafana Alerting Library – Build vertical integrations on top of the industry-leading alerting solution

81 lines (76 loc) 3.19 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var msw = require('msw'); var Receivers = require('../../../api/notifications/v0alpha1/mocks/fakes/Receivers.cjs'); var listReceiverHandler = require('../../../api/notifications/v0alpha1/mocks/handlers/ReceiverHandlers/listReceiverHandler.cjs'); "use strict"; const simpleContactPointsList = Receivers.ListReceiverApiResponseFactory.build({ items: [ // contact point with for testing with multiple different integrations – should show "email, slack" description Receivers.ContactPointFactory.build({ spec: { integrations: [Receivers.EmailIntegrationFactory.build(), Receivers.SlackIntegrationFactory.build()] } }), // contact point for testing "email (2)" description Receivers.ContactPointFactory.build({ spec: { integrations: Receivers.EmailIntegrationFactory.buildList(2) } }), // contact point for testing "empty contact point" description Receivers.ContactPointFactory.build({ spec: { integrations: [] } }) ] }); const simpleContactPointsListScenario = [listReceiverHandler.listReceiverHandler(simpleContactPointsList)]; const withErrorScenario = [listReceiverHandler.listReceiverHandler(() => new msw.HttpResponse(null, { status: 500 }))]; const contactPointsListWithUnusableItems = Receivers.ListReceiverApiResponseFactory.build({ items: [ // Regular contact point (canUse: true) Receivers.ContactPointFactory.build({ spec: { title: "regular-contact-point", integrations: [Receivers.EmailIntegrationFactory.build()] }, metadata: { annotations: Receivers.ContactPointMetadataAnnotationsFactory.build({ "grafana.com/provenance": "" }) } }), // Imported contact point (canUse: false) Receivers.ContactPointFactory.build({ spec: { title: "imported-contact-point", integrations: [Receivers.SlackIntegrationFactory.build()] }, metadata: { annotations: Receivers.ContactPointMetadataAnnotationsFactory.build({ "grafana.com/provenance": "converted_prometheus", "grafana.com/canUse": "false" }) } }), // API provisioned contact point (canUse: true) Receivers.ContactPointFactory.build({ spec: { title: "api-provisioned-contact-point", integrations: [Receivers.EmailIntegrationFactory.build()] }, metadata: { annotations: Receivers.ContactPointMetadataAnnotationsFactory.build({ "grafana.com/provenance": "api" }) } }) ] }); const contactPointsListWithUnusableItemsScenario = [listReceiverHandler.listReceiverHandler(contactPointsListWithUnusableItems)]; exports.contactPointsListWithUnusableItems = contactPointsListWithUnusableItems; exports.contactPointsListWithUnusableItemsScenario = contactPointsListWithUnusableItemsScenario; exports.simpleContactPointsList = simpleContactPointsList; exports.simpleContactPointsListScenario = simpleContactPointsListScenario; exports.withErrorScenario = withErrorScenario; //# sourceMappingURL=ContactPointSelector.scenario.cjs.map