-
Notifications
You must be signed in to change notification settings - Fork 39
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
Added testcases for Tokens & TotalAmount Component #1629
base: develop
Are you sure you want to change the base?
Conversation
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.
This two million lines generated files look like a mistake to me.
Fixed the snapshot testcases to compare HTML instead of vm of the component. |
let wrapper; | ||
|
||
describe('TokenAmount', () => { | ||
beforeEach(() => { |
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.
There is no need to have a beforeEach
and a wrapper
variable deinfed out of scope, since you have only one test.
mocks: { | ||
$store: { | ||
state: {}, | ||
getters: {}, |
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.
You can import and use particular getters
instead of mocking them, in order to cover all the cases in the TokenAmount
component.
@@ -21,6 +21,7 @@ module.exports = { | |||
'<rootDir>/config/jest/setEnvVars.js', | |||
'<rootDir>/config/jest/setup.js', | |||
], | |||
collectCoverage: true, |
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.
I don't think we need to collect coverage on every run of test:unit
command. I think it would be better to track coverage differently.
#1778
/tests/e2e/screenshots | ||
/tests/e2e/videos/ | ||
/tests/e2e/screenshots/ | ||
/coverage |
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.
I think all changes to this file should be undone.
@@ -0,0 +1,34 @@ | |||
import { shallowMount } from '@vue/test-utils'; | |||
import Tokens from '../../src/popup/components/Tokens.vue'; |
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.
This test is not covering all the potential cases of Tokens
component.
The PR should be properly rebased to consist only of meaningful commits, also commit names should be align with the template we are using in this repo. |
In general, I would skip matching the snapshot and would rather test the logic of the component, because:
|
@NitinRamnani There are few suggestions, would you work on fixing it? We can merge this once the PR is approved. |
I've added testcases for Tokens & TotalAmount Components which have increased code coverage of those components.
Before PR:
After PR: