Fix copy paste of widget value (#284)

* Fix copy paste of widget value

* Fix ui tests

* Allow undefined group font size

* Update test expectations [skip ci]

* nit

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2024-08-03 14:22:43 -04:00
committed by GitHub
parent f0f867481d
commit 0cf5e647af
8 changed files with 93 additions and 88 deletions

View File

@@ -38,8 +38,11 @@ describe('example workflows', () => {
lg.teardown(global)
})
for (const file of readdirSync(WORKFLOW_DIR)) {
if (!file.endsWith('.json')) continue
const workflowFiles = readdirSync(WORKFLOW_DIR).filter((file) =>
file.endsWith('.json')
)
const workflows = workflowFiles.map((file) => {
const { workflow, prompt } = JSON.parse(
readFileSync(path.resolve(WORKFLOW_DIR, file), 'utf8')
)
@@ -53,17 +56,24 @@ describe('example workflows', () => {
skip = !!Object.keys(parsedWorkflow?.extra?.groupNodes ?? {}).length
} catch (error) {}
;(skip ? test.skip : test)(
'correctly generates prompt json for ' + file,
async () => {
if (!workflow || !prompt) throw new Error('Invalid example json')
return { file, workflow, prompt, parsedWorkflow, skip }
})
const { app } = await start()
await app.loadGraphData(parsedWorkflow)
describe.each(workflows)(
'Workflow Test: %s',
({ file, workflow, prompt, parsedWorkflow, skip }) => {
;(skip ? test.skip : test)(
'correctly generates prompt json for ' + file,
async () => {
if (!workflow || !prompt) throw new Error('Invalid example json')
const output = await app.graphToPrompt()
expect(output.output).toEqual(fixLegacyPrompt(JSON.parse(prompt)))
}
)
}
const { app } = await start()
await app.loadGraphData(parsedWorkflow)
const output = await app.graphToPrompt()
expect(output.output).toEqual(fixLegacyPrompt(JSON.parse(prompt)))
}
)
}
)
})