rusackas commented on a change in pull request #13931:
URL: https://github.com/apache/superset/pull/13931#discussion_r607307353



##########
File path: 
superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
##########
@@ -0,0 +1,319 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import { render, screen, waitFor } from 'spec/helpers/testing-library';
+import fetchMock from 'fetch-mock';
+import userEvent from '@testing-library/user-event';
+import * as ColorSchemeControlWrapper from 
'src/dashboard/components/ColorSchemeControlWrapper';
+import * as FF from 'src/featureFlags';
+import * as SupersetCore from '@superset-ui/core';
+import PropertiesModal from '.';
+
+const spyIsFeatureEnabled = jest.spyOn(FF, 'isFeatureEnabled');
+const spyColorSchemeControlWrapper = jest.spyOn(
+  ColorSchemeControlWrapper,
+  'default',
+);
+
+spyColorSchemeControlWrapper.mockImplementation(
+  () => (<div>ColorSchemeControlWrapper</div>) as any,
+);
+
+fetchMock.get(
+  'http://localhost/api/v1/dashboard/related/roles?q=(filter:%27%27)',
+  {
+    body: {
+      count: 6,
+      result: [
+        {
+          text: 'Admin',
+          value: 1,
+        },
+        {
+          text: 'Alpha',
+          value: 3,
+        },
+        {
+          text: 'Gamma',
+          value: 4,
+        },
+        {
+          text: 'granter',
+          value: 5,
+        },
+        {
+          text: 'Public',
+          value: 2,
+        },
+        {
+          text: 'sql_lab',
+          value: 6,
+        },
+      ],
+    },
+  },
+);
+
+fetchMock.get(
+  'http://localhost/api/v1/dashboard/related/owners?q=(filter:%27%27)',
+  {
+    body: {
+      count: 1,
+      result: [
+        {
+          text: 'Superset Admin',
+          value: 1,
+        },
+      ],
+    },
+  },
+);
+
+fetchMock.get('http://localhost/api/v1/dashboard/26', {
+  body: {
+    result: {
+      changed_by: null,
+      changed_by_name: '',
+      changed_by_url: '',
+      changed_on: '2021-03-30T19:30:14.020942',
+      charts: [
+        'Vaccine Candidates per Country & Stage',
+        'Vaccine Candidates per Country',
+        'Vaccine Candidates per Country',
+        'Vaccine Candidates per Approach & Stage',
+        'Vaccine Candidates per Phase',
+        'Vaccine Candidates per Phase',
+        'Vaccine Candidates per Country & Stage',
+        'Filtering Vaccines',
+      ],
+      css: '',
+      dashboard_title: 'COVID Vaccine Dashboard',
+      id: 26,
+      json_metadata:
+        '{"timed_refresh_immune_slices": [], "expanded_slices": {}, 
"refresh_frequency": 0, "default_filters": "{}", "color_scheme": 
"supersetColors", "label_colors": {"0": "#D3B3DA", "1": "#9EE5E5", "0. 
Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II": "#454E7C", "1. Phase 
I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized": "#666666", "root": 
"#1FA8C9", "Protein subunit": "#454E7C", "Phase II": "#5AC189", "Pre-clinical": 
"#FF7F44", "Phase III": "#666666", "Phase I": "#E04355", "Phase I/II": 
"#FCC700", "Inactivated virus": "#A868B7", "Virus-like particle": "#3CCCCB", 
"Replicating bacterial vector": "#A38F79", "DNA-based": "#8FD3E4", "RNA-based 
vaccine": "#A1A6BD", "Authorized": "#ACE1C4", "Non-replicating viral vector": 
"#FEC0A1", "Replicating viral vector": "#B2B2B2", "Unknown": "#EFA1AA", "Live 
attenuated virus": "#FDE380", "COUNT(*)": "#D1C6BC"}, "filter_scopes": {"358": 
{"Country_Name": {"scope": ["ROOT_ID"], "immune": []}, "Product_Category": 
{"scope": ["ROOT_ID"
 ], "immune": []}, "Clinical Stage": {"scope": ["ROOT_ID"], "immune": []}}}}',
+      owners: [],
+      position_json:

Review comment:
       Agreed... we can put a pass on our roadmap to audit for reusable mock 
data, and make it a more systemic process/library, I could see that being a 
huge timesaver.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to