Files
openchamber/packages/ui/src/components/chat/PermissionCard.test.ts
T
Bohdan Triapitsyn 1ba3807df5 fix: hide duplicated bash permission pattern
Removes permission patterns already shown as the rendered bash command
Keeps distinct patterns visible in the permission card
Adds tests for the pattern filtering behavior
2026-07-22 16:40:42 +03:00

18 lines
660 B
TypeScript

import { describe, expect, test } from 'bun:test';
import { getVisiblePermissionPatterns } from './permissionCardPatterns';
describe('getVisiblePermissionPatterns', () => {
test('omits a pattern already rendered as the bash command', () => {
const command = 'bunx eslint "src/components/session/SessionSidebar.tsx"';
expect(getVisiblePermissionPatterns([command], command)).toEqual([]);
});
test('preserves distinct permission patterns', () => {
const command = 'bunx eslint "src/components/session/SessionSidebar.tsx"';
expect(getVisiblePermissionPatterns(['bunx eslint *', command], command)).toEqual(['bunx eslint *']);
});
});