Commit 4f7c7b15 authored by Dave Pisek's avatar Dave Pisek

Reviewer feedback: Test description fixes

parent b45accce
......@@ -194,28 +194,31 @@ describe('Project Licenses', () => {
${'policies'} | ${1}
${'foo'} | ${0}
${'bar'} | ${0}
`('when the url contains $givenUrlHash hash', ({ givenLocationHash, expectedTabIndex }) => {
beforeEach(() => {
setWindowLocation({
href: `${TEST_HOST}#${givenLocationHash}`,
});
createComponent({
state: {
initialized: true,
},
options: {
provide: {
glFeatures: { licensePolicyList: true },
`(
'when the url contains $givenLocationHash hash',
({ givenLocationHash, expectedTabIndex }) => {
beforeEach(() => {
setWindowLocation({
href: `${TEST_HOST}#${givenLocationHash}`,
});
createComponent({
state: {
initialized: true,
},
},
options: {
provide: {
glFeatures: { licensePolicyList: true },
},
},
});
});
});
it(`sets the tabIndex to be "${expectedTabIndex}`, () => {
expect(wrapper.find(GlTabs).attributes('value')).toBe(`${expectedTabIndex}`);
});
});
it(`sets the tabIndex to be "${expectedTabIndex}"`, () => {
expect(wrapper.find(GlTabs).attributes('value')).toBe(`${expectedTabIndex}`);
});
},
);
it.each`
givenTabIndex | expectedLocationHash
......
......@@ -8,22 +8,22 @@ describe('setWindowLocationHelper', () => {
});
it.each`
locationProperty | value
${'hash'} | ${'foo'}
${'host'} | ${'gitlab.com'}
${'hostname'} | ${'gitlab.com'}
${'href'} | ${'https://gitlab.com/foo'}
${'origin'} | ${'https://gitlab.com'}
${'origin'} | ${'/foo'}
${'port'} | ${'80'}
${'protocol'} | ${'https:'}
`('sets "window.location.$locationProperty" to be $value', ({ locationProperty, value }) => {
expect(window.location[locationProperty]).not.toBe(value);
property | value
${'hash'} | ${'foo'}
${'host'} | ${'gitlab.com'}
${'hostname'} | ${'gitlab.com'}
${'href'} | ${'https://gitlab.com/foo'}
${'origin'} | ${'https://gitlab.com'}
${'origin'} | ${'/foo'}
${'port'} | ${'80'}
${'protocol'} | ${'https:'}
`('sets "window.location.$property" to be $value', ({ property, value }) => {
expect(window.location).toBe(originalLocation);
setWindowLocationHelper({
[locationProperty]: value,
[property]: value,
});
expect(window.location[locationProperty]).toBe(value);
expect(window.location[property]).toBe(value);
});
});
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