-
Notifications
You must be signed in to change notification settings - Fork 0
Add test coverage for vortex-wavespec module #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: toolate28 <105518313+toolate28@users.noreply.github.com>
c196894 to
ff3287e
Compare
|
🌀 Agent Review: Coherence >60%. Ethical quantum sims validated. Ready for merge. |
|
🌀 Agent Review: Coherence >60%. Ethical quantum sims validated. Ready for merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive test coverage for the vortex-wavespec module, which previously lacked tests despite containing complex coherence calculations and normalization logic. The tests follow the established patterns used in other quantum-ethics modules.
Changes:
- Added 33 tests covering all exported functions and types from the vortex-wavespec module
- Tests validate coherence scoring, normalization (0-100 → 0-1 scale), node handling, ATOM decision creation, and formatting
- Includes edge case testing for Fibonacci coherence boost calculations and integration tests for end-to-end workflows
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test('should pass when coherence meets threshold', () => { | ||
| // This text should generate high coherence score | ||
| const analysisText = 'Excellent coherence quality metrics with consistent wave patterns and optimal performance indicators demonstrating superior system alignment'; | ||
| const result = runVortexCheck(analysisText); | ||
|
|
||
| // The score should be normalized to 0-1 range | ||
| expect(result.coherenceScore).toBeGreaterThanOrEqual(0); | ||
| expect(result.coherenceScore).toBeLessThanOrEqual(1); | ||
| }); |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test name suggests it verifies pass/fail behavior when coherence meets the threshold, but the test only checks that the score is normalized to the 0-1 range. Consider either adding an assertion to verify result.passed is true, or renaming the test to better reflect what it actually tests, such as "should normalize coherence score for high coherence text".
| describe('fibonacciCoherenceBoost', () => { | ||
| test('should boost coherence at iteration 0', () => { | ||
| const baseCoherence = 0.5; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 0); | ||
|
|
||
| expect(boosted).toBeGreaterThanOrEqual(baseCoherence); | ||
| expect(boosted).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should boost coherence at higher iterations', () => { | ||
| const baseCoherence = 0.6; | ||
| const boost1 = fibonacciCoherenceBoost(baseCoherence, 1); | ||
| const boost2 = fibonacciCoherenceBoost(baseCoherence, 2); | ||
| const boost3 = fibonacciCoherenceBoost(baseCoherence, 5); | ||
|
|
||
| expect(boost1).toBeGreaterThanOrEqual(baseCoherence); | ||
| expect(boost2).toBeGreaterThanOrEqual(baseCoherence); | ||
| expect(boost3).toBeGreaterThanOrEqual(baseCoherence); | ||
|
|
||
| // All should be capped at 1.0 | ||
| expect(boost1).toBeLessThanOrEqual(1); | ||
| expect(boost2).toBeLessThanOrEqual(1); | ||
| expect(boost3).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should cap boost at 1.0', () => { | ||
| const baseCoherence = 0.95; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 10); | ||
|
|
||
| expect(boosted).toBe(1); | ||
| }); | ||
|
|
||
| test('should handle low base coherence', () => { | ||
| const baseCoherence = 0.1; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 3); | ||
|
|
||
| expect(boosted).toBeGreaterThan(baseCoherence); | ||
| expect(boosted).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should handle high iteration counts', () => { | ||
| const baseCoherence = 0.5; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 100); | ||
|
|
||
| // Should be capped even with very high iterations | ||
| expect(boosted).toBeGreaterThanOrEqual(baseCoherence); | ||
| expect(boosted).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should produce consistent results', () => { | ||
| const baseCoherence = 0.7; | ||
| const iteration = 5; | ||
|
|
||
| const result1 = fibonacciCoherenceBoost(baseCoherence, iteration); | ||
| const result2 = fibonacciCoherenceBoost(baseCoherence, iteration); | ||
|
|
||
| expect(result1).toBe(result2); | ||
| }); | ||
|
|
||
| test('should increase boost with higher iterations', () => { | ||
| const baseCoherence = 0.5; | ||
|
|
||
| const boost1 = fibonacciCoherenceBoost(baseCoherence, 1); | ||
| const boost5 = fibonacciCoherenceBoost(baseCoherence, 5); | ||
| const boost10 = fibonacciCoherenceBoost(baseCoherence, 10); | ||
|
|
||
| // Later iterations should generally give higher boosts (until cap) | ||
| expect(boost5).toBeGreaterThanOrEqual(boost1); | ||
| expect(boost10).toBeGreaterThanOrEqual(boost5); | ||
| }); | ||
|
|
||
| test('should handle zero base coherence', () => { | ||
| const baseCoherence = 0; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 5); | ||
|
|
||
| expect(boosted).toBeGreaterThanOrEqual(0); | ||
| expect(boosted).toBeLessThanOrEqual(1); | ||
| }); | ||
|
|
||
| test('should handle perfect base coherence', () => { | ||
| const baseCoherence = 1.0; | ||
| const boosted = fibonacciCoherenceBoost(baseCoherence, 5); | ||
|
|
||
| // Should remain at 1.0 | ||
| expect(boosted).toBe(1); | ||
| }); | ||
| }); |
Copilot
AI
Jan 17, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests for fibonacciCoherenceBoost do not cover negative iteration values. The implementation uses FIBONACCI[fibIndex] without validating that the iteration is non-negative, which could lead to undefined behavior. Consider adding a test case for negative iterations to ensure the function handles this edge case gracefully.
|
@copilot apply changes based on the comments in this thread |
The vortex-wavespec module lacked test coverage despite having complex coherence calculations and normalization logic. This adds comprehensive tests following patterns established in other quantum-ethics modules.
Test Coverage Added:
runVortexCheck: Validates coherence scoring, node handling, ATOM decision creation, and pass/fail logiccreateVortexPayload: Verifies dashboard payload structure, vortex clusters, endpoint statuses, and coherence normalization (0-100 → 0-1 scale)formatVortexReport: Tests report formatting with various node statuses and pass/fail statesfibonacciCoherenceBoost: Validates boost calculations, capping at 1.0, and edge casesExample test structure:
32 tests added, all passing. Total quantum-ethics test suite: 74 tests.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.