feat: expand EasyCode software factory workflows
This commit is contained in:
68
RuoYi-Vue/ruoyi-ui/test/promptRegistryView.test.mjs
Normal file
68
RuoYi-Vue/ruoyi-ui/test/promptRegistryView.test.mjs
Normal file
@@ -0,0 +1,68 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const read = path => readFileSync(resolve(root, path), 'utf8')
|
||||
|
||||
test('prompt registry api exposes immutable version publication operations', () => {
|
||||
const api = read('src/api/generator/prompt.js')
|
||||
for (const name of [
|
||||
'listPromptTemplates',
|
||||
'getPromptTemplate',
|
||||
'addPromptTemplate',
|
||||
'updatePromptTemplate',
|
||||
'createPromptVersion',
|
||||
'publishPromptVersion',
|
||||
'rollbackPromptVersion',
|
||||
'initializePromptV1'
|
||||
]) {
|
||||
assert.equal(api.includes(`export function ${name}`), true, `${name} should be exported`)
|
||||
}
|
||||
assert.match(api, /versions\/\$\{promptVersionId\}\/publish/)
|
||||
assert.match(api, /versions\/\$\{promptVersionId\}\/rollback/)
|
||||
})
|
||||
|
||||
test('prompt registry view manages templates and version lifecycle', () => {
|
||||
const view = read('src/views/generator/prompt/index.vue')
|
||||
assert.match(view, /name: 'PromptRegistry'/)
|
||||
assert.match(view, /class="version-drawer-body"/)
|
||||
assert.match(view, /创建草稿/)
|
||||
assert.match(view, /publishPromptVersion/)
|
||||
assert.match(view, /rollbackPromptVersion/)
|
||||
assert.match(view, /generator:prompt:publish/)
|
||||
assert.match(view, /generator:prompt:rollback/)
|
||||
assert.match(view, /contentHash/)
|
||||
assert.match(view, /currentFingerprint/)
|
||||
assert.match(view, /builtinRelease/)
|
||||
assert.match(view, /初始化 V1/)
|
||||
assert.doesNotMatch(view, /<textarea/)
|
||||
})
|
||||
|
||||
test('prompt center exposes online debugging and A/B experiment workflows', () => {
|
||||
const api = read('src/api/generator/prompt.js')
|
||||
const view = read('src/views/generator/prompt/index.vue')
|
||||
for (const name of [
|
||||
'listPromptModels',
|
||||
'debugPrompt',
|
||||
'listPromptDebugRuns',
|
||||
'scorePromptDebugRun',
|
||||
'listPromptExperiments',
|
||||
'addPromptExperiment',
|
||||
'comparePromptExperiment',
|
||||
'getPromptExperimentStats'
|
||||
]) {
|
||||
assert.equal(api.includes(`export function ${name}`), true, `${name} should be exported`)
|
||||
}
|
||||
assert.match(view, /Prompt 在线调试/)
|
||||
assert.match(view, /Prompt A\/B 测试/)
|
||||
assert.match(view, /generator:prompt:debug/)
|
||||
assert.match(view, /generator:prompt:experiment/)
|
||||
assert.match(view, /runDebug/)
|
||||
assert.match(view, /runCompare/)
|
||||
assert.match(view, /scorePromptDebugRun/)
|
||||
assert.match(view, /User Prompt 模板/)
|
||||
assert.match(view, /\{\{input\}\}/)
|
||||
})
|
||||
Reference in New Issue
Block a user