Skip to content

Commit

Permalink
fix(helper): Test setup mimics sandbox environment. (#341)
Browse files Browse the repository at this point in the history
Remove unused test commands from root
  • Loading branch information
BibiSebi authored Jan 25, 2024
1 parent 9477367 commit 1e8889e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
9 changes: 8 additions & 1 deletion packages/field-plugin/helpers/test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -110,15 +112,20 @@ export const setupFieldPlugin = () => {
let handleEvent: (event: MessageEvent<unknown>) => 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
}
Expand Down

1 comment on commit 1e8889e

@vercel
Copy link

@vercel vercel bot commented on 1e8889e Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.