Skip to content

Instantly share code, notes, and snippets.

@x8BitRain
Created January 22, 2024 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save x8BitRain/1bcffd8298f53d22c6293e5d6d3435ab to your computer and use it in GitHub Desktop.
Save x8BitRain/1bcffd8298f53d22c6293e5d6d3435ab to your computer and use it in GitHub Desktop.
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