Skip to content

Commit 4699b9f

Browse files
committed
test(app-shell): read a folded AND list's elements as rules where a test reads the operator
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgXa2W2ZCA4huS5hVVx
1 parent fa15002 commit 4699b9f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/views/viewFilterFold.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
import { describe, it, expect } from 'vitest';
1919
import { ListViewSchema } from '@objectstack/spec/ui';
20+
import type { ViewFilterRule } from '@objectstack/spec/ui';
2021
import { foldFilterGroupToSpecRules, FILTER_FOLD_REFUSAL_KEYS } from './viewFilterFold';
2122

2223
/**
@@ -119,7 +120,8 @@ describe('foldFilterGroupToSpecRules — flat AND group → ViewFilterRule[]', (
119120
})),
120121
});
121122
expect(result.ok).toBe(true);
122-
expect(result.ok && result.rules.map(r => r.operator)).toEqual([
123+
// An AND group folds to flat rules only, so each element is a rule here.
124+
expect(result.ok && result.rules.map(r => (r as ViewFilterRule).operator)).toEqual([
123125
'equals', 'not_equals', 'contains', 'not_contains',
124126
'is_empty', 'is_not_empty', 'greater_than', 'less_than',
125127
'greater_than_or_equal', 'less_than_or_equal', 'before', 'after', 'between',
@@ -133,7 +135,7 @@ describe('foldFilterGroupToSpecRules — flat AND group → ViewFilterRule[]', (
133135
conditions: [{ id: 'a', field: 'f', operator: 'sounds_like', value: 'x' }],
134136
});
135137
// NOT silently rewritten to `equals` — the spec enum is the judge.
136-
expect(result.ok && result.rules[0].operator).toBe('sounds_like');
138+
expect(result.ok && (result.rules[0] as ViewFilterRule).operator).toBe('sounds_like');
137139
});
138140

139141
it('drops the blank row `Add filter` inserts before a column is picked', () => {

0 commit comments

Comments
 (0)