Skip to content

Commit ffe77fd

Browse files
committed
test(pii): drop the custom-pattern editor's backtracking-screen assertion
CI caught this; my local runs only covered `lib/**` and missed the `.tsx` counterpart of removing `safe-regex2`. The editor asserted that `(a+)+$` renders "potentially unsafe". That screen is gone, so the assertion is inverted: the test now pins that `(a+)+$`, lookbehind and optional groups all render cleanly, which is the point of the removal — they are valid Presidio patterns that could not be saved before. Syntactically invalid patterns still surface "Invalid regex".
1 parent 6a579ef commit ffe77fd

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

apps/sim/components/pii/custom-patterns-editor.test.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,18 @@ describe('CustomPatternsEditor', () => {
4949
expect(container.textContent).toMatch(/Invalid regex/)
5050
})
5151

52-
it('shows an inline error for a catastrophic-backtracking pattern', () => {
53-
renderEditor([row('(a+)+$')], vi.fn())
54-
expect(container.textContent).toMatch(/potentially unsafe/)
55-
})
52+
it.each(['(a+)+$', '(?<=id: )\\w+', '(?:https?://)?example\\.com'])(
53+
'accepts %s, which the removed safe-regex2 screen rejected',
54+
(pattern) => {
55+
// The editor no longer runs a catastrophic-backtracking screen. It caught
56+
// `(a+)+$` but passed `a*a*b`, so it deterred only the obvious spelling
57+
// while blocking valid Presidio patterns like lookbehind. These patterns
58+
// run in Presidio, not in this process.
59+
renderEditor([row(pattern)], vi.fn())
60+
expect(container.textContent).not.toMatch(/potentially unsafe/)
61+
expect(container.textContent).not.toMatch(/Invalid regex/)
62+
}
63+
)
5664

5765
it('appends an empty row when "Add pattern" is clicked', () => {
5866
const onChange = vi.fn()

0 commit comments

Comments
 (0)