From 1e8889e7bfa5baae158509601fc9851e7e4a6877 Mon Sep 17 00:00:00 2001 From: Bibiana Sebestianova <17590227+BibiSebi@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:59:03 +0100 Subject: [PATCH] fix(helper): Test setup mimics sandbox environment. (#341) Remove unused test commands from root --- package.json | 2 -- packages/field-plugin/helpers/test/src/index.ts | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f1c924d5..10636287 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,6 @@ "dev:vue3": "yarn dev:template vue3", "test:template": "yarn workspace field-plugin-${0}-template test --config node_modules/.${0}-vite.config.ts --ui", "test:react": "yarn test:template react", - "test:js": "yarn test:template js", - "test:vue2": "yarn test:template vue2", "test:vue3": "yarn test:template vue3", "bump-version": "./scripts/bump-version.ts" }, diff --git a/packages/field-plugin/helpers/test/src/index.ts b/packages/field-plugin/helpers/test/src/index.ts index 0960ef29..971dbb98 100644 --- a/packages/field-plugin/helpers/test/src/index.ts +++ b/packages/field-plugin/helpers/test/src/index.ts @@ -9,6 +9,8 @@ import { import { vi } from 'vitest' +const sandboxOrigin: string = 'https://plugin-sandbox.storyblok.com' + const getContainer = (sendToFieldPlugin: (data: unknown) => void) => { const schema = { field_type: 'test-field-plugin', @@ -110,15 +112,20 @@ export const setupFieldPlugin = () => { let handleEvent: (event: MessageEvent) => void const container = getContainer((data: unknown) => { // @ts-ignore - handleEvent({ data }) + handleEvent({ + data, + origin: sandboxOrigin, + }) }) global.ResizeObserver = class ResizeObserver { observe() { // do nothing } + unobserve() { // do nothing } + disconnect() { // do nothing }