mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 16:56:40 +08:00
Improve type safety in name test form and theme test
This commit is contained in:
@@ -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)')
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user