import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'

const settingsScript = readFileSync(new URL('../src/views/scripts/SettingsView.js', import.meta.url), 'utf8')
const settingsView = readFileSync(new URL('../src/views/SettingsView.vue', import.meta.url), 'utf8')

function testLlmSectionReplacesVlmWithReranker() {
  assert.doesNotMatch(settingsView, /VLM 模型/)
  assert.match(settingsView, /Reranker 模型配置/)
  assert.match(settingsScript, /rerankerProvider/)
}

function testRerankerCardRendersAfterEmbeddingCard() {
  assert.match(settingsView, /Embedding 模型配置[\s\S]*Reranker 模型配置/)
}

function run() {
  testLlmSectionReplacesVlmWithReranker()
  testRerankerCardRendersAfterEmbeddingCard()
  console.log('settings llm section tests passed')
}

run()
