-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from Quetzacoalt91/test-gmc-card
Avoid stories to impact each other & Add first unit tests for GMC card
- Loading branch information
Showing
25 changed files
with
242 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
_dev/src/components/merchant-center-account/merchant-center-account-card.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import Vuex from 'vuex'; | ||
|
||
// Import this file first to init mock on window | ||
import {commonOptions, cloneStore} from '@/../tests/init'; | ||
|
||
import {shallowMount} from '@vue/test-utils'; | ||
import MerchantCenterAccountCard from '@/components/merchant-center-account/merchant-center-account-card.vue'; | ||
import BadgeListRequirements from '@/components/commons/badge-list-requirements.vue'; | ||
import BootstrapVue, {BAlert} from 'bootstrap-vue'; | ||
import { | ||
merchantCenterAccountNotConnected, | ||
merchantCenterAccountConnected, | ||
} from '../../../.storybook/mock/merchant-center-account'; | ||
|
||
describe('merchant-center-account-card.vue', () => { | ||
it('does show almot nothing when it is not actived yet', () => { | ||
const wrapper = shallowMount(MerchantCenterAccountCard, { | ||
propsData: { | ||
isEnabled: false, | ||
}, | ||
...commonOptions, | ||
store: new Vuex.Store(cloneStore()), | ||
}); | ||
wrapper.vm.$refs.mcaSelection = undefined; | ||
|
||
// Check disabled state | ||
expect(wrapper.find('.ps_gs-onboardingcard').classes('ps_gs-onboardingcard--disabled')).toBe(true); | ||
expect(wrapper.findComponent(BadgeListRequirements)).toBeTruthy(); | ||
// Check existing GMC list, selected account details are not displayed | ||
expect(wrapper.find('#mcaSelection').exists()).toBeFalsy(); | ||
expect(wrapper.findComponent(BAlert).exists()).toBeFalsy(); | ||
}); | ||
|
||
it('does show almost nothing when it is not actived yet', () => { | ||
const wrapper = shallowMount(MerchantCenterAccountCard, { | ||
propsData: { | ||
isEnabled: false, | ||
}, | ||
...commonOptions, | ||
store: new Vuex.Store(cloneStore()), | ||
}); | ||
|
||
// Check disabled state | ||
expect(wrapper.find('.ps_gs-onboardingcard').classes('ps_gs-onboardingcard--disabled')).toBe(true); | ||
expect(wrapper.findComponent(BadgeListRequirements).exists()).toBeTruthy(); | ||
// Check existing GMC list, selected account details are not displayed | ||
expect(wrapper.find('#mcaSelection').exists()).toBeFalsy(); | ||
expect(wrapper.findComponent(BAlert).exists()).toBeFalsy(); | ||
}); | ||
|
||
it('show the link to create an account when enabled', () => { | ||
const wrapper = shallowMount(MerchantCenterAccountCard, { | ||
propsData: { | ||
isEnabled: true, | ||
}, | ||
...commonOptions, | ||
store: new Vuex.Store(cloneStore()), | ||
}); | ||
|
||
// Check enabled state | ||
expect(wrapper.find('.ps_gs-onboardingcard').classes('ps_gs-onboardingcard--disabled')).toBe(false); | ||
expect(wrapper.findComponent(BadgeListRequirements).exists()).toBeFalsy(); | ||
// Check button to create an account exists | ||
expect(wrapper.find('.material-icons').text()).toBe('person_add'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.