Created
January 22, 2024 15:06
-
-
Save x8BitRain/1bcffd8298f53d22c6293e5d6d3435ab to your computer and use it in GitHub Desktop.
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
describe('Test helpcenter visibility based on initData on mobile', () => { | |
const { configurator, roomdesigner, disable } = | |
FALLBACK_INIT_DATA.featureFlags.helpcenter; | |
it.each` | |
configurator | roomdesigner | disable | isPlanner | expected | reason | |
${configurator} | ${roomdesigner} | ${disable} | ${true} | ${true} | ${'default behavior for planner should be visible'} | |
${configurator} | ${roomdesigner} | ${disable} | ${false} | ${false} | ${'default behavior for configurator should not be visible'} | |
${true} | ${true} | ${false} | ${false} | ${true} | ${'should show in configurator if explicitly enabled'} | |
${true} | ${false} | ${false} | ${true} | ${false} | ${'should not show in planner if explicitly disabled'} | |
${true} | ${true} | ${true} | ${true} | ${false} | ${'disable: true should never show helpcenter'} | |
`( | |
'helpcenter: when ' + | |
'\n\t configurator: $configurator, ' + | |
'\n\t roomdesigner: $roomdesigner, ' + | |
'\n\t disable: $disable, ' + | |
'\n\t isPlanner: $isPlanner, ' + | |
'\n\t visibility should be $expected, ' + | |
'\n\t because -> $reason', | |
({ | |
configurator, | |
roomdesigner, | |
disable, | |
isPlanner, | |
expected, | |
_reason, | |
}) => { | |
const wrapper = factory( | |
{ | |
isPlanner: isPlanner, | |
initData: { | |
featureFlags: { | |
helpcenter: { | |
configurator: configurator, | |
roomdesigner: roomdesigner, | |
disable: disable, | |
}, | |
}, | |
}, | |
}, | |
{}, | |
{ isDesktop: false }, | |
); | |
expect(wrapper.find('[data-test-id="help-button"]').exists()).toBe( | |
expected, | |
); | |
}, | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment