Address PR feedback: refactor browser tests for better type safety

This commit is contained in:
DrJKL
2026-01-12 18:02:59 -08:00
parent 3a0c84145c
commit 4c46f5786b
14 changed files with 131 additions and 177 deletions

View File

@@ -268,10 +268,11 @@ test.describe('Node library sidebar', () => {
const setting = (await comfyPage.getSetting(
'Comfy.NodeLibrary.BookmarksCustomization'
)) as Record<string, { icon?: string; color?: string }> | undefined
await expect(setting).toHaveProperty(['foo/', 'color'])
await expect(setting?.['foo/'].color).not.toBeNull()
await expect(setting?.['foo/'].color).not.toBeUndefined()
await expect(setting?.['foo/'].color).not.toBe('')
expect(setting).toHaveProperty(['foo/', 'color'])
expect(setting?.['foo/']).toBeDefined()
expect(setting?.['foo/']?.color).not.toBeNull()
expect(setting?.['foo/']?.color).not.toBeUndefined()
expect(setting?.['foo/']?.color).not.toBe('')
})
test('Can rename customized bookmark folder', async ({ comfyPage }) => {

View File

@@ -182,7 +182,9 @@ test.describe('Workflows sidebar', () => {
// Compare the exported workflow with the original
expect(downloadedContent).toBeDefined()
expect(downloadedContentZh).toBeDefined()
if (!downloadedContent || !downloadedContentZh) return
if (!downloadedContent || !downloadedContentZh) {
throw new Error('Downloaded workflow content is undefined')
}
delete downloadedContent.id
delete downloadedContentZh.id
expect(downloadedContent).toEqual(downloadedContentZh)