Copilot commented on code in PR #37262: URL: https://github.com/apache/superset/pull/37262#discussion_r2728852093
########## superset-frontend/src/dashboard/util/getDropPosition.test.ts: ########## @@ -0,0 +1,504 @@ +/** + * 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 getDropPosition, { + DROP_TOP, + DROP_RIGHT, + DROP_BOTTOM, + DROP_LEFT, + DROP_FORBIDDEN, +} from 'src/dashboard/util/getDropPosition'; + +import { + CHART_TYPE, + DASHBOARD_GRID_TYPE, + DASHBOARD_ROOT_TYPE, + HEADER_TYPE, + ROW_TYPE, + TAB_TYPE, +} from 'src/dashboard/util/componentTypes'; +import { ComponentType } from '../types'; + +type ClientOffset = { + x: number; + y: number; +}; + +type DOMRectLike = { + top: number; + right: number; + bottom: number; + left: number; +}; + +type DropTargetMonitor = { + getItem: () => { + id: string; + type: ComponentType; + }; + getClientOffset: () => ClientOffset; Review Comment: Type inconsistency: The test mock for `getClientOffset` returns a non-nullable `ClientOffset`, but the implementation expects `getClientOffset()` to potentially return `null` (getDropPosition.ts line 79: `getClientOffset: () => ClientOffset | null`). The test should match the implementation's type signature to ensure proper test coverage of null handling scenarios. ```suggestion getClientOffset: () => ClientOffset | null; ``` ########## superset-frontend/src/dashboard/util/getDropPosition.test.ts: ########## @@ -0,0 +1,504 @@ +/** + * 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 getDropPosition, { + DROP_TOP, + DROP_RIGHT, + DROP_BOTTOM, + DROP_LEFT, + DROP_FORBIDDEN, +} from 'src/dashboard/util/getDropPosition'; + +import { + CHART_TYPE, + DASHBOARD_GRID_TYPE, + DASHBOARD_ROOT_TYPE, + HEADER_TYPE, + ROW_TYPE, + TAB_TYPE, +} from 'src/dashboard/util/componentTypes'; +import { ComponentType } from '../types'; + +type ClientOffset = { + x: number; + y: number; +}; + +type DOMRectLike = { + top: number; + right: number; + bottom: number; + left: number; +}; + +type DropTargetMonitor = { + getItem: () => { + id: string; + type: ComponentType; + }; + getClientOffset: () => ClientOffset; +}; + +type DropTargetComponent = { + props: { + depth: number; + parentComponent: { Review Comment: Type inconsistency between test and implementation: The test defines `parentComponent` as a required field (line 60), but the implementation defines it as optional (getDropPosition.ts line 58: `parentComponent?:`). The test mock should match the implementation's type signature by making `parentComponent` optional to accurately reflect the runtime behavior and prevent false confidence in type safety. ```suggestion parentComponent?: { ``` ########## superset-frontend/src/dashboard/util/getDropPosition.test.ts: ########## @@ -0,0 +1,504 @@ +/** + * 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 getDropPosition, { + DROP_TOP, + DROP_RIGHT, + DROP_BOTTOM, + DROP_LEFT, + DROP_FORBIDDEN, +} from 'src/dashboard/util/getDropPosition'; + +import { + CHART_TYPE, + DASHBOARD_GRID_TYPE, + DASHBOARD_ROOT_TYPE, + HEADER_TYPE, + ROW_TYPE, + TAB_TYPE, +} from 'src/dashboard/util/componentTypes'; +import { ComponentType } from '../types'; + +type ClientOffset = { + x: number; + y: number; +}; + +type DOMRectLike = { + top: number; + right: number; + bottom: number; + left: number; +}; + +type DropTargetMonitor = { + getItem: () => { + id: string; + type: ComponentType; + }; Review Comment: Type inconsistency: The test mock for `getItem` returns a non-nullable object, but the implementation expects `getItem()` to potentially return `null` (getDropPosition.ts line 78: `getItem: () => DraggingItem | null`). The test should match the implementation's type signature to ensure proper test coverage of null handling scenarios. ```suggestion } | null; ``` -- 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]
