## 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
102 lines
2.4 KiB
TypeScript
102 lines
2.4 KiB
TypeScript
import { put } from "redux-saga/effects";
|
|
import { setDefaultActionDisplayFormat } from "./PluginActionSagaUtils";
|
|
|
|
const actionid = "test-id";
|
|
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const plugin: any = {
|
|
id: "test-plugin",
|
|
name: "Test",
|
|
type: "API",
|
|
packageName: "test-package",
|
|
uiComponent: "ApiEditorForm",
|
|
datasourceComponent: "RestAPIDatasourceForm",
|
|
templates: {
|
|
test: "test",
|
|
},
|
|
responseType: "JSON",
|
|
};
|
|
|
|
describe("PluginActionSagasUtils", () => {
|
|
it("should set the default action display format without any bugs as long as dataTypes is there", () => {
|
|
const payload = {
|
|
body: [],
|
|
headers: {
|
|
headers: ["test-headers"],
|
|
},
|
|
statusCode: "200",
|
|
dataTypes: [
|
|
{
|
|
dataType: "JSON",
|
|
},
|
|
],
|
|
duration: "1000",
|
|
size: "10kb",
|
|
};
|
|
|
|
const generator = setDefaultActionDisplayFormat(actionid, plugin, payload);
|
|
|
|
expect(generator.next().value).toEqual(
|
|
put({
|
|
type: "SET_ACTION_RESPONSE_DISPLAY_FORMAT",
|
|
payload: {
|
|
id: "test-id",
|
|
field: "responseDisplayFormat",
|
|
value: "JSON",
|
|
},
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("If the response type is not present in the dataType, then it should pick the first dataType in the array", () => {
|
|
const payload = {
|
|
body: [],
|
|
headers: {
|
|
headers: ["test-headers"],
|
|
},
|
|
statusCode: "200",
|
|
dataTypes: [
|
|
{
|
|
dataType: "TABLE",
|
|
},
|
|
{
|
|
dataType: "RAW",
|
|
},
|
|
],
|
|
duration: "1000",
|
|
size: "10kb",
|
|
};
|
|
|
|
const generator = setDefaultActionDisplayFormat(actionid, plugin, payload);
|
|
|
|
expect(generator.next().value).toEqual(
|
|
put({
|
|
type: "SET_ACTION_RESPONSE_DISPLAY_FORMAT",
|
|
payload: {
|
|
id: "test-id",
|
|
field: "responseDisplayFormat",
|
|
value: "TABLE",
|
|
},
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("If dataType is an empty array, then no action should be dispatched and no bugs should happen", () => {
|
|
const payload = {
|
|
body: [],
|
|
headers: {
|
|
headers: ["test-headers"],
|
|
},
|
|
statusCode: "200",
|
|
dataTypes: [],
|
|
duration: "1000",
|
|
size: "10kb",
|
|
};
|
|
|
|
const generator = setDefaultActionDisplayFormat(actionid, plugin, payload);
|
|
|
|
expect(generator.next().value).toBeUndefined();
|
|
});
|
|
});
|