surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | import { describe, expect, test, tier } from 'claude-code/testing' |
| 2 | |
| 3 | import Policy from '../../hooks/policy' |
| 4 | import Fixtures from '../fixtures' |
| 5 | |
| 6 | tier('prepend') |
| 7 | |
| 8 | describe('is-managed-mods-only', () => { |
| 9 | test('true locks; absent or false leaves mods as they are', () => { |
| 10 | expect( |
| 11 | [ |
| 12 | Fixtures.modsPolicyOf(true), |
| 13 | Fixtures.modsPolicyOf(false), |
| 14 | Fixtures.NO_ALLOWLIST, |
| 15 | {}, |
| 16 | ].map(Policy.isManagedModsOnly), |
| 17 | ).toEqual([true, false, false, false]) |
| 18 | }) |
| 19 | |
| 20 | test('a value mistyped still locks, as a managed lock reads', () => { |
| 21 | expect( |
| 22 | [ |
| 23 | Fixtures.modsPolicyOf('true'), |
| 24 | Fixtures.modsPolicyOf('false'), |
| 25 | Fixtures.modsPolicyOf(1), |
| 26 | Fixtures.modsPolicyOf(0), |
| 27 | ].map(Policy.isManagedModsOnly), |
| 28 | ).toEqual([true, true, true, true]) |
| 29 | }) |
| 30 | |
| 31 | test('only its own pluginConfigs entry is read', () => { |
| 32 | expect( |
| 33 | [ |
| 34 | { allowManagedModsOnly: true }, |
| 35 | { pluginConfigs: { allowManagedModsOnly: true } }, |
| 36 | { |
| 37 | pluginConfigs: { |
| 38 | 'guard@corp-market': { options: { allowManagedModsOnly: true } }, |
| 39 | }, |
| 40 | }, |
| 41 | { pluginConfigs: 'cc-plugin-sec-default@builtin' }, |
| 42 | ].map(Policy.isManagedModsOnly), |
| 43 | ).toEqual([false, false, false, false]) |
| 44 | }) |
| 45 | }) |