beforeEach(() => {
        jest.resetAllMocks();

        // Set up a happy path by default
        config.set('page', {
            contentType: 'Article',
            isMinuteArticle: false,
            section: 'politics',
            pageId: 'politics-article',
            shouldHideAdverts: false,
            shouldHideReaderRevenue: false,
            isFront: false,
            showRelatedContent: true,
        });

        config.set('switches', {
            outbrain: true,
            commercial: true,
            enableDiscussionSwitch: true,
        });

        window.location.hash = '';

        userPrefs.removeSwitch('adverts');

        getBreakpoint.mockReturnValue('desktop');
        isPayingMember.mockReturnValue(false);
        isRecentOneOffContributor.mockReturnValue(false);
        shouldHideSupportMessaging.mockReturnValue(false);
        isAdFreeUser.mockReturnValue(false);
        isUserLoggedIn.mockReturnValue(true);

        expect.hasAssertions();
    });
Example #2
0
 it('should remove a user preference under a given key', () => {
     userPrefs.removeSwitch('s');
     expect(userPrefs.get('s')).toBeNull();
 });