Commit e00bd27e authored by Vitaly Slobodin's avatar Vitaly Slobodin

Use it instead of test in Jest specs

To unify our codebase we decided to use `it`
in Jest specs instead of `test`. The ESLint rule is coming.
parent b8f5c54d
...@@ -298,7 +298,7 @@ describe('Vulnerability Header', () => { ...@@ -298,7 +298,7 @@ describe('Vulnerability Header', () => {
}); });
describe('state badge', () => { describe('state badge', () => {
test.each(vulnerabilityStateEntries)( it.each(vulnerabilityStateEntries)(
'the vulnerability state badge has the correct style for the %s state', 'the vulnerability state badge has the correct style for the %s state',
(state, stateObject) => { (state, stateObject) => {
createWrapper({ state }); createWrapper({ state });
......
...@@ -42,15 +42,15 @@ describe('IssueLink component', () => { ...@@ -42,15 +42,15 @@ describe('IssueLink component', () => {
wrapper = createWrapper({ propsData: { issue } }); wrapper = createWrapper({ propsData: { issue } });
}); });
test('should contain the correct issue icon', () => { it('should contain the correct issue icon', () => {
expect(findIssueWithState(state)).toBeTruthy(); expect(findIssueWithState(state)).toBeTruthy();
}); });
test('should contain a link to the issue', () => { it('should contain a link to the issue', () => {
expect(findIssueLink(issue.iid).attributes('href')).toBe(issue.webUrl); expect(findIssueLink(issue.iid).attributes('href')).toBe(issue.webUrl);
}); });
test('should contain the title', () => { it('should contain the title', () => {
const tooltip = getBinding(findIssueLink(issue.iid).element, 'gl-tooltip'); const tooltip = getBinding(findIssueLink(issue.iid).element, 'gl-tooltip');
expect(tooltip).toBeDefined(); expect(tooltip).toBeDefined();
expect(tooltip.value).toBe(issue.title); expect(tooltip.value).toBe(issue.title);
......
...@@ -37,7 +37,7 @@ describe('Vulnerability state dropdown component', () => { ...@@ -37,7 +37,7 @@ describe('Vulnerability state dropdown component', () => {
afterEach(() => wrapper.destroy()); afterEach(() => wrapper.destroy());
describe('tests that need to manually create the wrapper', () => { describe('tests that need to manually create the wrapper', () => {
test.each(vulnerabilityStateEntries)( it.each(vulnerabilityStateEntries)(
'dropdown is created with the %s state already selected', 'dropdown is created with the %s state already selected',
(stateString, stateObject) => { (stateString, stateObject) => {
createWrapper(stateString); createWrapper(stateString);
...@@ -51,7 +51,7 @@ describe('Vulnerability state dropdown component', () => { ...@@ -51,7 +51,7 @@ describe('Vulnerability state dropdown component', () => {
expect(isSelected(dropdownItems())).toBe(false); expect(isSelected(dropdownItems())).toBe(false);
}); });
test.each(vulnerabilityStateEntries)( it.each(vulnerabilityStateEntries)(
`when the %s dropdown item is clicked, it's the only one that's selected`, `when the %s dropdown item is clicked, it's the only one that's selected`,
(stateString, stateObject) => { (stateString, stateObject) => {
// Start off with an unknown state so we can click through each item and see it change. // Start off with an unknown state so we can click through each item and see it change.
......
...@@ -55,7 +55,7 @@ describe('Error message', () => { ...@@ -55,7 +55,7 @@ describe('Error message', () => {
'Upload skipped. Some of the designs you tried uploading did not change: 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg, and 2 more.', 'Upload skipped. Some of the designs you tried uploading did not change: 1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg, and 2 more.',
], ],
])('designUploadSkippedWarning', (uploadedFiles, skippedFiles, expected) => { ])('designUploadSkippedWarning', (uploadedFiles, skippedFiles, expected) => {
test('returns expected warning message', () => { it('returns expected warning message', () => {
expect(designUploadSkippedWarning(uploadedFiles, skippedFiles)).toBe(expected); expect(designUploadSkippedWarning(uploadedFiles, skippedFiles)).toBe(expected);
}); });
}); });
......
...@@ -9,7 +9,7 @@ describe('tokenization for .vue files', () => { ...@@ -9,7 +9,7 @@ describe('tokenization for .vue files', () => {
registerLanguages(vue); registerLanguages(vue);
}); });
test.each([ it.each([
[ [
'<div v-if="something">content</div>', '<div v-if="something">content</div>',
[ [
......
...@@ -436,7 +436,7 @@ describe('Dashboard header', () => { ...@@ -436,7 +436,7 @@ describe('Dashboard header', () => {
}); });
}); });
test.each(systemDashboards)('is rendered for system dashboards', dashboardPath => { it.each(systemDashboards)('is rendered for system dashboards', dashboardPath => {
setupAllDashboards(store, dashboardPath); setupAllDashboards(store, dashboardPath);
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
...@@ -444,7 +444,7 @@ describe('Dashboard header', () => { ...@@ -444,7 +444,7 @@ describe('Dashboard header', () => {
}); });
}); });
test.each(nonSystemDashboards)('is not rendered for non-system dashboards', dashboardPath => { it.each(nonSystemDashboards)('is not rendered for non-system dashboards', dashboardPath => {
setupAllDashboards(store, dashboardPath); setupAllDashboards(store, dashboardPath);
return wrapper.vm.$nextTick(() => { return wrapper.vm.$nextTick(() => {
......
...@@ -24,7 +24,7 @@ describe('GroupEmptyState', () => { ...@@ -24,7 +24,7 @@ describe('GroupEmptyState', () => {
'FOO STATE', // does not fail with unknown states 'FOO STATE', // does not fail with unknown states
]; ];
test.each(supportedStates)('Renders an empty state for %s', selectedState => { it.each(supportedStates)('Renders an empty state for %s', selectedState => {
const wrapper = createComponent({ selectedState }); const wrapper = createComponent({ selectedState });
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
......
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