hunk.code_window: import static com.appsmith.server.acl.AclPermission.MANAGE_PAGES;
   import static com.appsmith.server.acl.AclPermission.READ_ACTIONS;
   import static com.appsmith.server.acl.AclPermission.READ_PAGES;
   import static org.assertj.core.api.Assertions.assertThat;
   import static org.junit.Assert.assertTrue;
   @RunWith(SpringRunner.class)
   @SpringBootTest
   @Slf4j
  
hunk.labels: keep keep keep keep replace keep keep keep keep
hunk.file_path: app/server/appsmith-server/src/test/java/com/appsmith/server/services/PageServiceTest.java
hunk.type: replace
file: import { ReduxActionTypes } from "constants/ReduxActionConstants";
  import { SubmissionError } from "redux-form";
  export type InviteUsersToOrgByRoleValues = {
    id: string;
    users?: string;
    role?: string;
  };
  export type InviteUsersToOrgFormValues = {
    usersByRole: InviteUsersToOrgByRoleValues[];
  };
  
  export type CreateOrganizationFormValues = {
    name: string;
  };
  
  export const createOrganizationSubmitHandler = (
    values: CreateOrganizationFormValues,
    dispatch: any,
  ): Promise<any> => {
    return new Promise((resolve, reject) => {
      dispatch({
        type: ReduxActionTypes.CREATE_ORGANIZATION_INIT,
        payload: {
          resolve,
          reject,
          name: values.name,
        },
      });
    }).catch((error) => {
      throw new SubmissionError(error);
    });
  };
  
  export const inviteUsersToOrgSubmitHandler = (
    values: InviteUsersToOrgFormValues,
    dispatch: any,
  ): Promise<any> => {
    const data = values.usersByRole.map((value) => ({
      roleId: value.role,
      emails: value.users ? value.users.split(",") : [],
    }));
    return new Promise((resolve, reject) => {
      dispatch({
        type: ReduxActionTypes.INVITE_USERS_TO_ORG_INIT,
        payload: {
          resolve,
          reject,
          data,
        },
      });
    }).catch((error) => {
      throw new SubmissionError(error);
    });
  };
  
  export const inviteUsersToOrg = (values: any, dispatch: any): Promise<any> => {
    const data = {
      roleName: values.role,
      usernames: values.users ? values.users.split(",") : [],
      orgId: values.orgId,
    };
    return new Promise((resolve, reject) => {
      dispatch({
        type: ReduxActionTypes.INVITE_USERS_TO_ORG_INIT,
        payload: {
          resolve,
          reject,
          data,
        },
      });
    }).catch((error) => {
      throw new SubmissionError(error);
    });
  };
  