test(web): guard shared IP policy edit warnings (SNP-832)

This commit is contained in:
CodingOnStar committed 2026-09-20 17:31:00 +08:00
1 parent 0f487e51bf
commit 94b4591c8e
1 file changed
+25 -1
@@ -1,4 +1,4 @@
import { screen } from '@testing-library/react'
import { screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { useState } from 'react'
import { renderWithConsoleQuery as render } from '@/test/console/query-data'
@@ -213,4 +213,28 @@ describe('trusted current IP and allowlist editing', () => {
})
},
)
it.each([
{ mode: 'edit', count: 0 },
{ mode: 'view', count: 2 },
] as const)(
'does not show an immediate-effect warning in $mode with $count references',
async ({ mode, count }) => {
render(
<IpPolicyDialog
open
mode={mode}
initialName="Office"
initialEntries={['10.0.0.0/8']}
usedByCount={count}
onOpenChange={vi.fn()}
/>,
)
await waitFor(() =>
expect(
screen.queryByText('Changes take effect immediately wherever this policy is applied.'),
).not.toBeInTheDocument(),
)
},
)
})