PromucFlow_constructor/app/client/src/sagas/WidgetBlueprintSagas.test.ts
Ashok Kumar M 353c91b8fa
fix: jest test failures coz of getIsAnvilLayout (#32664)
[![workerB](https://img.shields.io/endpoint?url=https%3A%2F%2Fworkerb.linearb.io%2Fv2%2Fbadge%2Fprivate%2FU2FsdGVkX1JO6UjhWrZEl6JP180WytEbimcxoUzA0%2Fcollaboration.svg%3FcacheSeconds%3D60)](https://workerb.linearb.io/v2/badge/collaboration-page?magicLinkId=8xbfQu9)
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._

Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## 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/8679486679>
> Commit: fe97e718498f1974e3604ae20160e99918f9c35c
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8679486679&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->








<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Simplified the logic for determining the layout system type in the
app.
- **Tests**
- Updated test files to remove unnecessary mock implementations related
to layout system checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-04-15 09:17:23 +05:30

51 lines
1.4 KiB
TypeScript

import WidgetFactory from "WidgetProvider/factory";
import { BlueprintOperationTypes } from "WidgetProvider/constants";
import type { BlueprintOperation } from "./WidgetBlueprintSagas";
import { executeWidgetBlueprintChildOperations } from "./WidgetBlueprintSagas";
describe("WidgetBlueprintSagas", () => {
it("should returns widgets after executing the child operation", async () => {
const mockBlueprintChildOperation: BlueprintOperation = {
type: BlueprintOperationTypes.CHILD_OPERATIONS,
fn: () => {
return { widgets: {} };
},
};
jest
.spyOn(WidgetFactory, "getWidgetDefaultPropertiesMap")
.mockReturnValue({});
const generator = executeWidgetBlueprintChildOperations(
mockBlueprintChildOperation,
{
widgetId: {
image: "",
defaultImage: "",
widgetId: "Widget1",
type: "LIST_WIDGET",
widgetName: "List1",
parentId: "parentId",
renderMode: "CANVAS",
parentColumnSpace: 2,
parentRowSpace: 3,
leftColumn: 2,
rightColumn: 3,
topRow: 1,
bottomRow: 3,
isLoading: false,
items: [],
version: 16,
disablePropertyPane: false,
},
},
["widgetId"],
"parentId",
);
generator.next();
expect(generator.next().value).toStrictEqual({});
});
});