codyml commented on code in PR #21351:
URL: https://github.com/apache/superset/pull/21351#discussion_r989578834


##########
superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx:
##########
@@ -0,0 +1,343 @@
+/**
+ * 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 userEvent from '@testing-library/user-event';
+import { render, screen, within } from 'spec/helpers/testing-library';
+import { getMockStoreWithNativeFilters } from 'spec/fixtures/mockStore';
+import chartQueries, { sliceId } from 'spec/fixtures/mockChartQueries';
+import { QueryObjectFilterClause } from '@superset-ui/core';
+import { Menu } from 'src/components/Menu';
+import DrillDetailMenuItems, {
+  DrillDetailMenuItemsProps,
+} from './DrillDetailMenuItems';
+
+/* eslint jest/expect-expect: ["warn", { "assertFunctionNames": ["expect*"] }] 
*/

Review Comment:
   For this file, I think that would result in a lot of duplicated code because 
I have a lot of `expect` calls in the helper functions: for example, 6 tests 
call `expectDrillToDetailEnabled`, which calls `expect` 5 times, so moving the 
`expect` calls to the top level would be 30 lines of code just for that check.  
Plus, I made the find/expect logic pretty intertwined and it's not super 
straightforward to untangle it.  That being said, I mostly just don't really 
understand the reasoning behind the default settings on this lint rule – what's 
the argument for having `expect` calls only at the top level of each test?  It 
seems to me like having a rule against factoring out shared test logic 
encourages writing less thorough tests and makes tests more brittle and less 
readable, but if I'm missing something here I can go ahead and rewrite these to 
have `expect` at the top level.



-- 
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: [email protected]

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