-
Notifications
You must be signed in to change notification settings - Fork 298
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: test cases #16860
base: master
Are you sure you want to change the base?
fix: test cases #16860
Conversation
mayuran-deriv
commented
Sep 16, 2024
•
edited
Loading
edited
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
A production App ID was automatically generated for this PR. (log)
Click here to copy & paste above information.
|
🚨 Lighthouse report for the changes in this PR:
Lighthouse ran with https://deriv-app-git-fork-mayuran-deriv-mayuran-utils-test-case.binary.sx/ |
Quality Gate passedIssues Measures |
⏳ Generating Lighthouse report... |
@@ -20,7 +20,7 @@ export const addDynamicBlockToDOM = ( | |||
shadow_block.appendChild(field_block); | |||
block.appendChild(shadow_block); | |||
|
|||
const amount_block = strategy_dom.querySelector('value[name="AMOUNT"]'); | |||
const amount_block = strategy_dom?.querySelector('value[name="AMOUNT"]'); |
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.
@mayuran-deriv is it necessary to use optional chaining here? strategy_dom
is a required argument. If this one is not passed, the next lines (from lines 24 to 29) will not be covered.
jest.mock('@deriv/translations', () => ({ | ||
localize: jest.fn((message, values) => { | ||
let result = message; | ||
if (values) { | ||
Object.keys(values).forEach(key => { | ||
result = result.replace(`{{${key}}}`, values[key]); | ||
}); | ||
} | ||
return result; | ||
}), | ||
})); |
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.
@mayuran-deriv do we need to mock @deriv/translations
? There is a global mock for this in here <root>/__mocks__/translation.mock.js
. Doesn't it work from there?