-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix: exclude Helminth
when testing warframe regression
#655
Conversation
WalkthroughThe changes made in this pull request involve updating the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
test/index.regression.spec.mjs (2)
Line range hint
5-8
: Consider adding error handling for API requestsThe
grab
function could benefit from proper error handling to make tests more reliable and provide better error messages when API requests fail.Consider this improvement:
const grab = async (path) => { - return fetch(`https://api.warframestat.us/${path}/?language=en`).then((d) => d.json()); + try { + const response = await fetch(`https://api.warframestat.us/${path}/?language=en`); + if (!response.ok) { + throw new Error(`API request failed: ${response.status} ${response.statusText}`); + } + return response.json(); + } catch (error) { + throw new Error(`Failed to fetch ${path}: ${error.message}`); + } };
Line range hint
24-63
: Consider refactoring duplicate test logicThe uniqueness tests for different items share similar logic and could be refactored into a reusable test helper.
Consider this refactor to reduce code duplication:
+ const assertUniqueResult = (items, itemName, checkComponents = false) => { + const matches = items + .filter((i) => i.name === itemName) + .map((i) => { + delete i.patchlogs; + return i; + }); + const dd = dedupe(matches); + assert.strictEqual(dd.length, matches.length, 'Before and after dedupe should match'); + assert.strictEqual(matches.length, 1, 'There can be only One'); + if (checkComponents) { + assert(Object.keys(matches[0]).includes('components')); + } + }; + it('weapons should only have 1 result for Mausolon', () => { - const matches = data.weapons - .filter((i) => i.name === 'Mausolon') - .map((i) => { - delete i.patchlogs; - return i; - }); - const dd = dedupe(matches); - assert.strictEqual(dd.length, matches.length, 'Before and after dedupe should match'); - assert.strictEqual(matches.length, 1, 'There can be only One'); + assertUniqueResult(data.weapons, 'Mausolon'); }); it('warframes should only have 1 result for Octavia Prime', () => { - const matches = data.warframes - .filter((i) => i.name === 'Octavia Prime') - .map((i) => { - delete i.patchlogs; - return i; - }); - const dd = dedupe(matches); - assert.strictEqual(dd.length, matches.length, 'Before and after dedupe should match'); - assert.strictEqual(matches.length, 1, 'There can be only One'); + assertUniqueResult(data.warframes, 'Octavia Prime'); }); it('items should only have 1 result for Octavia Prime', () => { - const matches = data.items - .filter((i) => i.name === 'Octavia Prime') - .map((i) => { - delete i.patchlogs; - return i; - }); - const dd = dedupe(matches); - assert.strictEqual(dd.length, matches.length, 'Before and after dedupe should match'); - assert.strictEqual(matches.length, 1, 'There can be only One'); - assert(Object.keys(matches[0]).includes('components')); + assertUniqueResult(data.items, 'Octavia Prime', true); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
test/index.regression.spec.mjs
(1 hunks)
🔇 Additional comments (1)
test/index.regression.spec.mjs (1)
16-16
: LGTM! Verify Helminth's lack of components
The addition of 'Helminth' to the exclusions array aligns with the PR objectives and fixes the regression test failure.
Let's verify that Helminth indeed has no components in the API data:
✅ Verification successful
Verified: Helminth exclusion is correctly added
The test file shows that namedExclusions
is used to skip component verification for specific warframes in the test suite. The exclusion is necessary as the test iterates through all warframes and verifies they have components, except for those in the exclusion list. Adding Helminth to this list indicates it's a special case warframe that doesn't follow the standard component structure, similar to the existing Excalibur Prime exclusion.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that Helminth warframe has no components in the API
curl -s "https://api.warframestat.us/warframes?language=en" | jq '.[] | select(.name == "Helminth") | .components'
Length of output: 173
Script:
#!/bin/bash
# Let's examine the test file to understand how the exclusions are used
cat test/index.regression.spec.mjs
Length of output: 2180
🎉 This PR is included in version 1.1265.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What did you fix?
Regression test failed when checking warframes for components as Helminth does not have components
Reproduction steps
Evidence/screenshot/link to line
Considerations
Summary by CodeRabbit