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:
Daniel Riccio
2025-01-14 17:57:55 -05:00
parent f6e85fa133
commit e00ec0cc3f

View File

@@ -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', () => {