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
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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 *']);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user