mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
test: add unit tests for NewUnifiedDiffStrategy constructor and confidence threshold behavior
- Introduced tests for the NewUnifiedDiffStrategy constructor to verify default and custom confidence thresholds. - Ensured that the minimum confidence threshold is enforced, preventing values below 0.8. - Enhanced test coverage for the strategy's initialization logic, improving overall reliability and maintainability.
This commit is contained in:
@@ -5,7 +5,24 @@ describe('main', () => {
|
|||||||
let strategy: NewUnifiedDiffStrategy
|
let strategy: NewUnifiedDiffStrategy
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
strategy = new NewUnifiedDiffStrategy()
|
strategy = new NewUnifiedDiffStrategy(0.97)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('constructor', () => {
|
||||||
|
it('should use default confidence threshold when not provided', () => {
|
||||||
|
const defaultStrategy = new NewUnifiedDiffStrategy()
|
||||||
|
expect(defaultStrategy['confidenceThreshold']).toBe(0.9)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should use provided confidence threshold', () => {
|
||||||
|
const customStrategy = new NewUnifiedDiffStrategy(0.85)
|
||||||
|
expect(customStrategy['confidenceThreshold']).toBe(0.85)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should enforce minimum confidence threshold', () => {
|
||||||
|
const lowStrategy = new NewUnifiedDiffStrategy(0.7) // Below minimum of 0.8
|
||||||
|
expect(lowStrategy['confidenceThreshold']).toBe(0.8)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getToolDescription', () => {
|
describe('getToolDescription', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user