Commit a5ab3e77 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch...

Merge branch 'dreedy-use-find-verbiage-instead-of-get-verbiage-for-spec-helper-methods' into 'master'

Use find rather than get verbiage for spec helpers

See merge request gitlab-org/gitlab!59049
parents 10787465 f565bd3c
...@@ -9,7 +9,7 @@ describe('TrialStatusPopover component', () => { ...@@ -9,7 +9,7 @@ describe('TrialStatusPopover component', () => {
let wrapper; let wrapper;
let trackingSpy; let trackingSpy;
const getGlButton = (testId) => wrapper.find(`[data-testid="${testId}"]`); const findByTestId = (testId) => wrapper.find(`[data-testid="${testId}"]`);
const createComponent = () => { const createComponent = () => {
return shallowMount(TrialStatusPopover, { return shallowMount(TrialStatusPopover, {
...@@ -41,14 +41,14 @@ describe('TrialStatusPopover component', () => { ...@@ -41,14 +41,14 @@ describe('TrialStatusPopover component', () => {
}); });
it('renders the upgrade button with correct tracking data attrs', () => { it('renders the upgrade button with correct tracking data attrs', () => {
const attrs = getGlButton('upgradeBtn').attributes(); const attrs = findByTestId('upgradeBtn').attributes();
expect(attrs['data-track-event']).toBe('click_button'); expect(attrs['data-track-event']).toBe('click_button');
expect(attrs['data-track-label']).toBe('upgrade_to_ultimate'); expect(attrs['data-track-label']).toBe('upgrade_to_ultimate');
expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar'); expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar');
}); });
it('renders the compare plans button with correct tracking data attrs', () => { it('renders the compare plans button with correct tracking data attrs', () => {
const attrs = getGlButton('compareBtn').attributes(); const attrs = findByTestId('compareBtn').attributes();
expect(attrs['data-track-event']).toBe('click_button'); expect(attrs['data-track-event']).toBe('click_button');
expect(attrs['data-track-label']).toBe('compare_all_plans'); expect(attrs['data-track-label']).toBe('compare_all_plans');
expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar'); expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar');
......
...@@ -6,7 +6,7 @@ import TrialStatusWidget from 'ee/contextual_sidebar/components/trial_status_wid ...@@ -6,7 +6,7 @@ import TrialStatusWidget from 'ee/contextual_sidebar/components/trial_status_wid
describe('TrialStatusWidget component', () => { describe('TrialStatusWidget component', () => {
let wrapper; let wrapper;
const getGlLink = () => wrapper.findComponent(GlLink); const findGlLink = () => wrapper.findComponent(GlLink);
const createComponent = (props = {}) => { const createComponent = (props = {}) => {
return shallowMount(TrialStatusWidget, { return shallowMount(TrialStatusWidget, {
...@@ -36,11 +36,11 @@ describe('TrialStatusWidget component', () => { ...@@ -36,11 +36,11 @@ describe('TrialStatusWidget component', () => {
}); });
it('renders without an id', () => { it('renders without an id', () => {
expect(getGlLink().attributes('id')).toBe(undefined); expect(findGlLink().attributes('id')).toBe(undefined);
}); });
it('renders with the correct tracking data attributes', () => { it('renders with the correct tracking data attributes', () => {
const attrs = getGlLink().attributes(); const attrs = findGlLink().attributes();
expect(attrs['data-track-event']).toBe('click_link'); expect(attrs['data-track-event']).toBe('click_link');
expect(attrs['data-track-label']).toBe('trial_status_widget'); expect(attrs['data-track-label']).toBe('trial_status_widget');
expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar'); expect(attrs['data-track-property']).toBe('experiment:show_trial_status_in_sidebar');
...@@ -53,7 +53,7 @@ describe('TrialStatusWidget component', () => { ...@@ -53,7 +53,7 @@ describe('TrialStatusWidget component', () => {
}); });
it('renders with the given id', () => { it('renders with the given id', () => {
expect(getGlLink().attributes('id')).toBe('some-id'); expect(findGlLink().attributes('id')).toBe('some-id');
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment