mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-26 09:44:06 +00:00
[Refactor/TS] Simplify node filter logic (#3275)
This commit is contained in:
@@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user