Skip to content
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

test: add unit test for src/app/src/pages/redteam/setup/components/strategies/utils.ts #3495

Conversation

gru-agent[bot]
Copy link
Contributor

@gru-agent gru-agent bot commented Mar 25, 2025

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
PR Created faizanminhas 3494 Detail

Summary

This PR introduces unit tests for utility functions getStrategyId and getEstimatedProbes in the utils.test.ts file. The tests ensure the correctness of these functions under various scenarios:

getStrategyId Tests:

  • Validates that the function correctly returns the strategy ID when the input is a string.

  • Confirms that the function extracts the id property when the input is an object.

getEstimatedProbes Tests:

  • Verifies probe calculation for configurations without strategies.

  • Tests probe calculation with strategy multipliers, including:

    • Basic strategies.

    • Multilingual strategies with specified and unspecified languages.

    • Complex configurations involving multiple strategies and plugins.

  • Ensures the function uses a default numTests value when not explicitly provided.

These tests improve the reliability of the utility functions and ensure accurate probe estimation across different configurations.

Coverage

The change in coverage value, such as: 0% -> 50%, indicates that the coverage was 0% before writing the tests and 50% after writing them.

https://web.dev/articles/ta-code-coverage

Type Change
lines 0% -> 100% 🔺
functions 100% -> 100%
statements 0% -> 100% 🔺
branches 100% -> 88.88% 🔻
source program

Test Statuses

Status Change
passed 0 -> 8 🔺
failed 0 -> 0
skipped 0 -> 0
source program

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Tip

You can @gru-agent rebase to rebase the PR.

Tip

You can @gru-agent redo to reset or rebase before redoing the PR.

Tip

To modify the test code yourself, click here Edit Test Code

Copy link
Contributor Author

gru-agent bot commented Mar 25, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha fe9c841...fe9c841
Head Sha 866e874...4315aac

Copy link
Contributor Author

gru-agent bot commented Mar 25, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha fe9c841...fe9c841
Head Sha 866e874...bae569f

@gru-agent gru-agent bot force-pushed the gru/src-app-src-pages-redteam-setup-components-strategies-utils-ts-1742944104941 branch 2 times, most recently from 4315aac to bae569f Compare March 25, 2025 23:09
Base automatically changed from faizan/fix-type to main March 25, 2025 23:19
Copy link
Contributor Author

gru-agent bot commented Mar 25, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha 7ecde24...7ecde24
Head Sha bae569f...bb60dc2

@gru-agent gru-agent bot force-pushed the gru/src-app-src-pages-redteam-setup-components-strategies-utils-ts-1742944104941 branch from bae569f to bb60dc2 Compare March 25, 2025 23:19
@faizanminhas faizanminhas merged commit fdb2524 into main Mar 26, 2025
27 checks passed
@faizanminhas faizanminhas deleted the gru/src-app-src-pages-redteam-setup-components-strategies-utils-ts-1742944104941 branch March 26, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants