Merge pull request #1036 from buster-so/nate/unit-tests-hot-fix

mock env variables
This commit is contained in:
Nate Kelley 2025-09-22 13:14:02 -06:00 committed by GitHub
commit 077606a625
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 11 deletions

View File

@ -1,9 +1,24 @@
import type { Value } from 'platejs';
import { createPlateEditor } from 'platejs/react';
import { describe, expect, it } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import { EditorKit } from '../../editor-kit';
import { markdownToPlatejs, platejsToMarkdown } from './platejs-conversions';
vi.mock('@/env', () => ({
env: {
VITE_PUBLIC_ENABLE_TANSTACK_PANEL: 'true',
VITE_PUBLIC_POSTHOG_HOST: 'https://example.com',
VITE_PUBLIC_POSTHOG_KEY: '1234567890',
VITE_PUBLIC_URL: 'https://example.com',
VITE_PUBLIC_SUPABASE_ANON_KEY: '1234567890',
VITE_PUBLIC_SUPABASE_URL: 'https://example.com',
VITE_PUBLIC_WS_URL: 'https://example.com',
VITE_PUBLIC_WEB_SOCKET_URL: 'https://example.com',
VITE_PUBLIC_API2_URL: 'https://example.com',
VITE_PUBLIC_API_URL: 'https://example.com',
},
}));
export const editor = createPlateEditor({
plugins: EditorKit({ scrollAreaRef: undefined, mode: 'default' }),
});

View File

@ -1,22 +1,12 @@
import { MediaPluginOptions } from '@platejs/media';
import {
AudioPlugin,
FilePlugin,
ImagePlugin,
MediaEmbedPlugin,
PlaceholderPlugin,
VideoPlugin,
} from '@platejs/media/react';
import { KEYS } from 'platejs';
import { CUSTOM_KEYS } from '../config/keys';
import { AudioElement } from '../elements/AudioNode';
import { MediaEmbedElement } from '../elements/MediaEmbedNode';
import { FileElement } from '../elements/MediaFileNode';
import { ImageElement } from '../elements/MediaImageNode';
import { PlaceholderElement } from '../elements/MediaPlaceholderElement';
import { MediaPreviewDialog } from '../elements/MediaPreviewDialog';
import { MediaUploadToast } from '../elements/MediaUploadToast';
import { VideoElement } from '../elements/MediaVideoNode';
export const MediaKit = [
ImagePlugin.configure({