test: migrate more test into browser mode, fix all existing tests
This commit is contained in:
@@ -12,6 +12,9 @@ describe('parseEnv', () => {
|
||||
AUTH_GOOGLE_CLIENT_SECRET: 'google-secret',
|
||||
AUTH_GITHUB_CLIENT_ID: 'github-client',
|
||||
AUTH_GITHUB_CLIENT_SECRET: 'github-secret',
|
||||
GATEWAY_BASE_URL: 'https://gateway.example',
|
||||
DEFAULT_CHAT_MODEL: 'openai/gpt-4o-mini',
|
||||
DEFAULT_TTS_MODEL: 'openai/gpt-4o-mini-tts',
|
||||
})
|
||||
|
||||
expect(env.DATABASE_URL).toBe('postgres://example')
|
||||
|
||||
@@ -46,6 +46,8 @@ describe('origin utils', () => {
|
||||
|
||||
expect(getAuthTrustedOrigins({ API_SERVER_URL: 'https://api.airi.moeru.ai' } as any, request)).toEqual([
|
||||
'https://api.airi.moeru.ai',
|
||||
'http://localhost:*',
|
||||
'http://127.0.0.1:*',
|
||||
'http://localhost:5173',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
import type { WidgetsAddPayload, WidgetSnapshot, WidgetsUpdatePayload } from '../../../../shared/eventa'
|
||||
import type { PluginHostService } from './types'
|
||||
|
||||
import { cp, mkdir, mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises'
|
||||
import { cp, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { basename, join, resolve } from 'node:path'
|
||||
|
||||
@@ -719,6 +719,7 @@ describe('setupPluginHost', () => {
|
||||
try {
|
||||
await stat(join(chessLikePluginRoot, 'dist'))
|
||||
await cp(join(chessLikePluginRoot, 'dist'), pluginDir, { recursive: true })
|
||||
await symlink(join(chessLikePluginRoot, 'node_modules'), join(pluginDir, 'node_modules'), 'junction')
|
||||
}
|
||||
catch {
|
||||
await mkdir(pluginDir, { recursive: true })
|
||||
@@ -766,19 +767,19 @@ describe('setupPluginHost', () => {
|
||||
),
|
||||
sandbox: 'allow-scripts allow-same-origin allow-forms allow-popups',
|
||||
}),
|
||||
windowSize: expect.objectContaining({
|
||||
width: 980,
|
||||
height: 840,
|
||||
minWidth: 640,
|
||||
minHeight: 640,
|
||||
}),
|
||||
}),
|
||||
config: expect.objectContaining({
|
||||
defaults: expect.objectContaining({
|
||||
airiSide: 'white',
|
||||
opening: 'queen-gambit',
|
||||
side: 'white',
|
||||
}),
|
||||
}),
|
||||
widgets: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: 'main-board',
|
||||
kind: 'primary',
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
}),
|
||||
]))
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('image_journal config snapshot', () => {
|
||||
const tools = await imageJournalTools()
|
||||
|
||||
expect(tools).toSatisfyStrictToolSchemas()
|
||||
})
|
||||
}, 15_000)
|
||||
|
||||
it('extracts plain values instead of leaking Ref objects', () => {
|
||||
const config = resolveArtistryConfigFromStore({
|
||||
|
||||
Reference in New Issue
Block a user