Skip to content

Commit 5afb074

Browse files
fix: coverage
1 parent 702a95f commit 5afb074

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/sidebar/components/test/HypothesisApp-test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe('HypothesisApp', () => {
1212
let fakeServiceConfig = null;
1313
let fakeSession = null;
1414
let fakeShouldAutoDisplayTutorial = null;
15+
let fakeShouldShowYoutubeDisclaimer = null;
1516
let fakeSettings = null;
1617
let fakeToastMessenger = null;
1718
let fakeIsThirdPartyService;
@@ -33,6 +34,7 @@ describe('HypothesisApp', () => {
3334
fakeApplyTheme = sinon.stub().returns({});
3435
fakeServiceConfig = sinon.stub();
3536
fakeShouldAutoDisplayTutorial = sinon.stub().returns(false);
37+
fakeShouldShowYoutubeDisclaimer = sinon.stub().returns(false);
3638

3739
fakeStore = {
3840
clearGroups: sinon.stub(),
@@ -88,6 +90,7 @@ describe('HypothesisApp', () => {
8890
'../store': { useSidebarStore: () => fakeStore },
8991
'../helpers/session': {
9092
shouldAutoDisplayTutorial: fakeShouldAutoDisplayTutorial,
93+
shouldShowYoutubeDisclaimer: fakeShouldShowYoutubeDisclaimer,
9194
},
9295
'../helpers/theme': { applyTheme: fakeApplyTheme },
9396
'../helpers/is-third-party-service': {
@@ -157,6 +160,34 @@ describe('HypothesisApp', () => {
157160
});
158161
});
159162

163+
describe('YouTube disclaimer banner', () => {
164+
it('renders YouTubeDisclaimerBanner when not on modal route and shouldShowYoutubeDisclaimer returns true', () => {
165+
fakeStore.route.returns('sidebar');
166+
fakeShouldShowYoutubeDisclaimer.returns(true);
167+
168+
const wrapper = createComponent();
169+
170+
assert.isTrue(wrapper.find('YouTubeDisclaimerBanner').exists());
171+
});
172+
173+
it('does not render YouTubeDisclaimerBanner when shouldShowYoutubeDisclaimer returns false', () => {
174+
fakeShouldShowYoutubeDisclaimer.returns(false);
175+
176+
const wrapper = createComponent();
177+
178+
assert.isFalse(wrapper.find('YouTubeDisclaimerBanner').exists());
179+
});
180+
181+
it('does not render YouTubeDisclaimerBanner on modal routes', () => {
182+
fakeShouldShowYoutubeDisclaimer.returns(true);
183+
fakeStore.route.returns('profile');
184+
185+
const wrapper = createComponent();
186+
187+
assert.isFalse(wrapper.find('YouTubeDisclaimerBanner').exists());
188+
});
189+
});
190+
160191
// Add tests for common behaviors shared between "Log in" and "Sign up" actions.
161192
function addCommonLoginTests(action) {
162193
const clickButton = wrapper =>

0 commit comments

Comments
 (0)