## Description - Enabled the rule `@typescript-eslint/no-explicit-any` - Suppressed errors with comment ``` // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any ``` Fixes #35308 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10181176984> > Commit: 7fc604e24fa234da7ab2ff56e0b1c715268796ee > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10181176984&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 31 Jul 2024 15:00:45 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No
72 lines
1.8 KiB
TypeScript
72 lines
1.8 KiB
TypeScript
import { cloneDeep, noop } from "lodash";
|
|
import type { DSLWidget } from "WidgetProvider/constants";
|
|
import { traverseDSLAndMigrate } from "./WidgetMigrationUtils";
|
|
|
|
const dsl = {
|
|
children: [
|
|
{
|
|
name: "widget1",
|
|
children: [
|
|
{
|
|
name: "widget2",
|
|
},
|
|
{
|
|
name: "widget3",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "widget4",
|
|
},
|
|
],
|
|
};
|
|
|
|
describe("traverseDSLAndMigrate", () => {
|
|
it("should check that migration function is getting called for each widget in the tree", () => {
|
|
const migrateFn = jest.fn();
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
traverseDSLAndMigrate(dsl as any as DSLWidget, migrateFn);
|
|
expect(migrateFn).toHaveBeenCalledTimes(4);
|
|
});
|
|
|
|
it("should check that tree structure remain intact", () => {
|
|
const copyDSL = cloneDeep(dsl);
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
traverseDSLAndMigrate(dsl as any as DSLWidget, noop);
|
|
expect(dsl).toEqual(copyDSL);
|
|
});
|
|
|
|
it("should check that migration function updates are written in the tree", () => {
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
traverseDSLAndMigrate(dsl as any as DSLWidget, (widget) => {
|
|
widget.type = "widget";
|
|
});
|
|
|
|
expect(dsl).toEqual({
|
|
children: [
|
|
{
|
|
name: "widget1",
|
|
type: "widget",
|
|
children: [
|
|
{
|
|
name: "widget2",
|
|
type: "widget",
|
|
},
|
|
{
|
|
name: "widget3",
|
|
type: "widget",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "widget4",
|
|
type: "widget",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|