import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { test } from "vitest"; import { compileTemplate, parse } from "vue/compiler-sfc"; const aiAssistantPath = fileURLToPath(new URL("../../apps/desktop/src/components/editor/AiAssistant.vue", import.meta.url)); const zhCnLocalePath = fileURLToPath(new URL("../../apps/desktop/src/i18n/locales/zh-CN.ts", import.meta.url)); const source = readFileSync(aiAssistantPath, "utf8"); const zhCnLocaleSource = readFileSync(zhCnLocalePath, "utf8"); test("AI composer keeps templates available without connections", () => { const contextRowStart = source.indexOf('
'); const contextRowEnd = source.indexOf('v-if="mentionOpen"', contextRowStart); const contextRow = source.slice(contextRowStart, contextRowEnd); assert.notEqual(contextRowStart, -1, "the composer context row should exist"); assert.notEqual(contextRowEnd, -1, "the connection context row should end before mention suggestions"); assert.match(contextRow, /