mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-04 23:18:44 +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 { readFileSync } from 'node:fs'
|
||||||
import { resolve } from 'node:path'
|
import { resolve } from 'node:path'
|
||||||
|
import { cwd } from 'node:process'
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
describe('text-moviepilot theme color', () => {
|
describe('text-moviepilot theme color', () => {
|
||||||
it('derives its gradient from the active Vuetify primary 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
|
const textMoviePilotRule = commonStyles.match(/\.text-moviepilot\s*\{(?<rule>[\s\S]*?)\n\}/)?.groups?.rule
|
||||||
|
|
||||||
expect(textMoviePilotRule).toContain('var(--v-theme-primary)')
|
expect(textMoviePilotRule).toContain('var(--v-theme-primary)')
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ interface MediaSourceDisplay {
|
|||||||
label: string
|
label: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface NameTestForm {
|
||||||
|
customWords: string | null
|
||||||
|
source: MediaDataSource
|
||||||
|
subtitle: string | null
|
||||||
|
title: string | null
|
||||||
|
}
|
||||||
|
|
||||||
const MEDIA_SOURCE_LABELS: Record<string, string> = {
|
const MEDIA_SOURCE_LABELS: Record<string, string> = {
|
||||||
anilist: 'AniList',
|
anilist: 'AniList',
|
||||||
bangumi: 'Bangumi',
|
bangumi: 'Bangumi',
|
||||||
@@ -74,7 +81,7 @@ const $toast = useToast()
|
|||||||
const nameTestResult = ref<Context>()
|
const nameTestResult = ref<Context>()
|
||||||
|
|
||||||
// 名称识别表单
|
// 名称识别表单
|
||||||
const nameTestForm = reactive({
|
const nameTestForm = reactive<NameTestForm>({
|
||||||
title: null,
|
title: null,
|
||||||
subtitle: null,
|
subtitle: null,
|
||||||
customWords: null,
|
customWords: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user