mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
This commit is contained in:
@@ -394,6 +394,20 @@ priority = -1
|
|||||||
expect(error.details).toContain('>= 0');
|
expect(error.details).toContain('>= 0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return a schema_validation error if priority is much lower than 0', async () => {
|
||||||
|
const result = await runLoadPoliciesFromToml(`
|
||||||
|
[[rule]]
|
||||||
|
toolName = "test"
|
||||||
|
decision = "allow"
|
||||||
|
priority = -9999
|
||||||
|
`);
|
||||||
|
expect(result.errors).toHaveLength(1);
|
||||||
|
const error = result.errors[0];
|
||||||
|
expect(error.errorType).toBe('schema_validation');
|
||||||
|
expect(error.details).toContain('priority');
|
||||||
|
expect(error.details).toContain('>= 0');
|
||||||
|
});
|
||||||
|
|
||||||
it('should return a schema_validation error if priority is >= 1000', async () => {
|
it('should return a schema_validation error if priority is >= 1000', async () => {
|
||||||
const result = await runLoadPoliciesFromToml(`
|
const result = await runLoadPoliciesFromToml(`
|
||||||
[[rule]]
|
[[rule]]
|
||||||
@@ -408,6 +422,20 @@ priority = 1000
|
|||||||
expect(error.details).toContain('<= 999');
|
expect(error.details).toContain('<= 999');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return a schema_validation error if priority is much higher than 1000', async () => {
|
||||||
|
const result = await runLoadPoliciesFromToml(`
|
||||||
|
[[rule]]
|
||||||
|
toolName = "test"
|
||||||
|
decision = "allow"
|
||||||
|
priority = 9999
|
||||||
|
`);
|
||||||
|
expect(result.errors).toHaveLength(1);
|
||||||
|
const error = result.errors[0];
|
||||||
|
expect(error.errorType).toBe('schema_validation');
|
||||||
|
expect(error.details).toContain('priority');
|
||||||
|
expect(error.details).toContain('<= 999');
|
||||||
|
});
|
||||||
|
|
||||||
it('should return a schema_validation error if decision is invalid', async () => {
|
it('should return a schema_validation error if decision is invalid', async () => {
|
||||||
const result = await runLoadPoliciesFromToml(`
|
const result = await runLoadPoliciesFromToml(`
|
||||||
[[rule]]
|
[[rule]]
|
||||||
|
|||||||
Reference in New Issue
Block a user