You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2023/01/09 19:26:02 UTC

[GitHub] [superset] lyndsiWilliams commented on a diff in pull request #22648: fix(dashboard): Add safety checks to areas that throw runtime errors in dashboard filters

lyndsiWilliams commented on code in PR #22648:
URL: https://github.com/apache/superset/pull/22648#discussion_r1065026428


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.test.ts:
##########
@@ -0,0 +1,18204 @@
+/**
+ * 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 { Layout } from 'src/dashboard/types';
+import { buildTree } from './utils';
+
+// The types defined for Layout and sub elements is not compatible with the data we get back fro a real dashboard layout
+// This test file is using data from a real example dashboard to test real world data sets.  ts-ignore is set for this entire file
+// until we can reconcile adjusting types to match the actual data structures used
+
+describe('Ensure buildTree does not throw runtime errors when encountering an invalid node', () => {
+  const node = {
+    children: ['TABS-97PVJa11D_'],
+    id: 'ROOT_ID',
+    type: 'ROOT',
+    parents: [],
+  };
+
+  const treeItem = {
+    children: [],
+    key: 'ROOT_ID',
+    type: 'ROOT',
+    title: 'All panels',
+  };
+
+  const layout: Layout = {

Review Comment:
   Could/should this be moved to a separate fixtures type of file to make the test more readable?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org