Improve type safety in name test form and theme test

This commit is contained in:
jxxghp
2026-07-31 15:14:38 +08:00
parent c957264b72
commit 38fe17ab99
2 changed files with 10 additions and 2 deletions
@@ -1,10 +1,11 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { cwd } from 'node:process'
import { describe, expect, it } from 'vitest'
describe('text-moviepilot theme color', () => {
it('derives its gradient from the active Vuetify primary color', () => {
const commonStyles = readFileSync(resolve(process.cwd(), 'src/styles/common.scss'), 'utf8')
const commonStyles = readFileSync(resolve(cwd(), 'src/styles/common.scss'), 'utf8')
const textMoviePilotRule = commonStyles.match(/\.text-moviepilot\s*\{(?<rule>[\s\S]*?)\n\}/)?.groups?.rule
expect(textMoviePilotRule).toContain('var(--v-theme-primary)')
+8 -1
View File
@@ -32,6 +32,13 @@ interface MediaSourceDisplay {
label: string
}
interface NameTestForm {
customWords: string | null
source: MediaDataSource
subtitle: string | null
title: string | null
}
const MEDIA_SOURCE_LABELS: Record<string, string> = {
anilist: 'AniList',
bangumi: 'Bangumi',
@@ -74,7 +81,7 @@ const $toast = useToast()
const nameTestResult = ref<Context>()
// 名称识别表单
const nameTestForm = reactive({
const nameTestForm = reactive<NameTestForm>({
title: null,
subtitle: null,
customWords: null,