Skip to content

Commit

Permalink
test: add PB context
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Sep 28, 2023
1 parent 5ed6b50 commit 158062f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/api-form-builder/__tests__/useGqlHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { FileManagerStorageOperations } from "@webiny/api-file-manager/types";
import { HeadlessCmsStorageOperations } from "@webiny/api-headless-cms/types";
import { CmsParametersPlugin, createHeadlessCmsContext } from "@webiny/api-headless-cms";
import { FormBuilderStorageOperations } from "~/types";
import {createPageBuilderContext} from "@webiny/api-page-builder";

export interface UseGqlHandlerParams {
permissions?: SecurityPermission[];
Expand All @@ -64,6 +65,7 @@ export default (params: UseGqlHandlerParams = {}) => {
const { permissions, identity, plugins = [] } = params;
const i18nStorage = getStorageOps("i18n");
const fileManagerStorage = getStorageOps<FileManagerStorageOperations>("fileManager");
const pageBuilderStorage = getStorageOps<FileManagerStorageOperations>("pageBuilder");
const formBuilderStorage = getStorageOps<FormBuilderStorageOperations>("formBuilder");
const cmsStorage = getStorageOps<HeadlessCmsStorageOperations>("cms");

Expand All @@ -85,9 +87,13 @@ export default (params: UseGqlHandlerParams = {}) => {
};
}),
createHeadlessCmsContext({ storageOperations: cmsStorage.storageOperations }),
createPageBuilderContext({
storageOperations: pageBuilderStorage.storageOperations
}),
createFileManagerContext({
storageOperations: fileManagerStorage.storageOperations
}),

createFileManagerGraphQL(),
createFormBuilder({
storageOperations: formBuilderStorage.storageOperations
Expand Down
1 change: 1 addition & 0 deletions packages/api-form-builder/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const base = require("../../jest.config.base");
const presets = require("@webiny/project-utils/testing/presets")(
["@webiny/api-form-builder", "storage-operations"],
["@webiny/api-page-builder", "storage-operations"],
["@webiny/api-file-manager", "storage-operations"],
["@webiny/api-headless-cms", "storage-operations"],
["@webiny/api-i18n", "storage-operations"],
Expand Down

0 comments on commit 158062f

Please sign in to comment.