Browse Source

test(integrations): TicketRulesModal Enzyme Tests (#22983)

Marcos Gaeta 4 years ago
parent
commit
eb593f9480

+ 1 - 0
package.json

@@ -163,6 +163,7 @@
     "jest": "26.6.3",
     "jest-canvas-mock": "^2.3.0",
     "jest-circus": "26.6.3",
+    "jest-fetch-mock": "^3.0.3",
     "jest-junit": "^9.0.0",
     "mockdate": "3.0.2",
     "object.fromentries": "^2.0.0",

+ 6 - 1
src/sentry/static/sentry/app/components/externalIssues/abstractExternalIssueForm.tsx

@@ -9,7 +9,7 @@ import {IntegrationIssueConfig, IssueConfigField} from 'app/types';
 import FieldFromConfig from 'app/views/settings/components/forms/fieldFromConfig';
 import Form from 'app/views/settings/components/forms/form';
 import {FieldValue} from 'app/views/settings/components/forms/model';
-import {FormField} from 'app/views/settings/projectAlerts/issueEditor/ruleNode';
+import {FormField} from 'app/views/settings/projectAlerts/issueRuleEditor/ruleNode';
 
 export type ExternalIssueAction = 'create' | 'link';
 
@@ -133,6 +133,11 @@ export default class AbstractExternalIssueForm<
     // Do nothing.
   };
 
+  /**
+   * Get the list of options for a field via debounced API call. For example,
+   * the list of users that match the input string. The Promise rejects if there
+   * are any errors.
+   */
   getOptions = (field: IssueConfigField, input: string) =>
     new Promise((resolve, reject) => {
       if (!input) {

+ 1 - 5
src/sentry/static/sentry/app/views/settings/components/forms/model.tsx

@@ -219,11 +219,7 @@ class FormModel {
   }
 
   getValue(id: string) {
-    if (!this.fields.has(id)) {
-      return '';
-    }
-
-    return this.fields.get(id);
+    return this.fields.has(id) ? this.fields.get(id) : '';
   }
 
   getTransformedValue(id: string) {

+ 2 - 2
src/sentry/static/sentry/app/views/settings/projectAlerts/create.tsx

@@ -13,7 +13,7 @@ import EventView from 'app/utils/discover/eventView';
 import {uniqueId} from 'app/utils/guid';
 import BuilderBreadCrumbs from 'app/views/alerts/builder/builderBreadCrumbs';
 import IncidentRulesCreate from 'app/views/settings/incidentRules/create';
-import IssueEditor from 'app/views/settings/projectAlerts/issueEditor';
+import IssueRuleEditor from 'app/views/settings/projectAlerts/issueRuleEditor';
 
 import AlertTypeChooser from './alertTypeChooser';
 
@@ -104,7 +104,7 @@ class Create extends React.Component<Props, State> {
           )}
 
           {(!hasMetricAlerts || alertType === 'issue') && (
-            <IssueEditor {...this.props} project={project} />
+            <IssueRuleEditor {...this.props} project={project} />
           )}
 
           {hasMetricAlerts && alertType === 'metric' && (

+ 1 - 1
src/sentry/static/sentry/app/views/settings/projectAlerts/edit.tsx

@@ -10,7 +10,7 @@ import space from 'app/styles/space';
 import {Organization, Project} from 'app/types';
 import BuilderBreadCrumbs from 'app/views/alerts/builder/builderBreadCrumbs';
 import IncidentRulesDetails from 'app/views/settings/incidentRules/details';
-import IssueEditor from 'app/views/settings/projectAlerts/issueEditor';
+import IssueEditor from 'app/views/settings/projectAlerts/issueRuleEditor';
 
 type RouteParams = {
   orgId: string;

+ 0 - 0
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/index.tsx → src/sentry/static/sentry/app/views/settings/projectAlerts/issueRuleEditor/index.tsx


+ 0 - 0
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/memberTeamFields.tsx → src/sentry/static/sentry/app/views/settings/projectAlerts/issueRuleEditor/memberTeamFields.tsx


+ 0 - 0
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/ruleNode.tsx → src/sentry/static/sentry/app/views/settings/projectAlerts/issueRuleEditor/ruleNode.tsx


+ 0 - 0
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/ruleNodeList.tsx → src/sentry/static/sentry/app/views/settings/projectAlerts/issueRuleEditor/ruleNodeList.tsx


+ 0 - 0
src/sentry/static/sentry/app/views/settings/projectAlerts/issueEditor/ticketRuleModal.tsx → src/sentry/static/sentry/app/views/settings/projectAlerts/issueRuleEditor/ticketRuleModal.tsx


Some files were not shown because too many files changed in this diff