PromucFlow_constructor/app/client/test/factories/PageFactory.ts
Nidhi de443104f2
chore: rm dr ce (#34765)
Co-authored-by: brayn003 <rudra@appsmith.com>
2024-07-31 08:24:51 +05:30

27 lines
723 B
TypeScript

import * as Factory from "factory.ts";
import type { Page } from "@appsmith/constants/ReduxActionConstants";
function generateRandomHexId() {
const hexChars = "0123456789abcdef";
let id = "";
for (let i = 0; i < 24; i++) {
id += hexChars[Math.floor(Math.random() * 16)];
}
return id;
}
export const PageFactory = Factory.Sync.makeFactory<Page>({
pageName: Factory.each((i) => `Page${i + 1}`),
pageId: Factory.each(() => generateRandomHexId()),
basePageId: Factory.each(() => generateRandomHexId()),
isDefault: false,
isHidden: false,
slug: Factory.each((i) => `pageSlug${i + 1}`),
userPermissions: [
"read:pages",
"manage:pages",
"create:pageActions",
"delete:pages",
],
});