[Refactor/TS] Simplify node filter logic (#3275)

This commit is contained in:
Chenlei Hu
2025-03-29 13:00:18 -04:00
committed by GitHub
parent 3922a5882b
commit fcc22f06ac
9 changed files with 211 additions and 178 deletions

View File

@@ -64,12 +64,14 @@ const EXAMPLE_NODE_DEFS: ComfyNodeDefImpl[] = (
describe('nodeSearchService', () => {
it('searches with input filter', () => {
const service = new NodeSearchService(EXAMPLE_NODE_DEFS)
const inputFilter = service.getFilterById('input')
// @ts-expect-error fixme ts strict error
expect(service.searchNode('L', [[inputFilter, 'LATENT']])).toHaveLength(1)
const inputFilter = service.inputTypeFilter
expect(
service.searchNode('L', [{ filterDef: inputFilter, value: 'LATENT' }])
).toHaveLength(1)
// Wildcard should match all.
// @ts-expect-error fixme ts strict error
expect(service.searchNode('L', [[inputFilter, '*']])).toHaveLength(2)
expect(
service.searchNode('L', [{ filterDef: inputFilter, value: '*' }])
).toHaveLength(2)
expect(service.searchNode('L')).toHaveLength(2)
})
})