Skip to content

Commit 6c63d03

Browse files
committed
Add snapshot tests
1 parent 7a331b6 commit 6c63d03

File tree

2 files changed

+1423
-0
lines changed

2 files changed

+1423
-0
lines changed

packages/core/test/feedback/FeedbackWidgetManager.test.tsx

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,118 @@ describe('FeedbackButtonManager', () => {
204204

205205
expect(getClient().getIntegrationByName(AUTO_INJECT_FEEDBACK_BUTTON_INTEGRATION_NAME)).toBeDefined();
206206
});
207+
208+
it('the Feedback Widget matches the snapshot with default configuration', () => {
209+
mockedIsModalSupported.mockReturnValue(true);
210+
const { toJSON } = render(
211+
<FeedbackWidgetProvider>
212+
<Text>App Components</Text>
213+
</FeedbackWidgetProvider>
214+
);
215+
216+
showFeedbackWidget();
217+
218+
expect(toJSON()).toMatchSnapshot();
219+
});
220+
221+
it('the Feedback Widget matches the snapshot with custom light theme', () => {
222+
mockedIsModalSupported.mockReturnValue(true);
223+
const { toJSON } = render(
224+
<FeedbackWidgetProvider>
225+
<Text>App Components</Text>
226+
</FeedbackWidgetProvider>
227+
);
228+
229+
const integration = feedbackIntegration({
230+
colorScheme: 'light',
231+
themeLight: {
232+
foreground: '#ff0000',
233+
background: '#00ff00',
234+
},
235+
});
236+
getClient()?.addIntegration(integration);
237+
238+
showFeedbackWidget();
239+
240+
expect(toJSON()).toMatchSnapshot();
241+
});
242+
243+
it('the Feedback Widget matches the snapshot with custom dark theme', () => {
244+
mockedIsModalSupported.mockReturnValue(true);
245+
const { toJSON } = render(
246+
<FeedbackWidgetProvider>
247+
<Text>App Components</Text>
248+
</FeedbackWidgetProvider>
249+
);
250+
251+
const integration = feedbackIntegration({
252+
colorScheme: 'dark',
253+
themeDark: {
254+
foreground: '#00ff00',
255+
background: '#ff0000',
256+
},
257+
});
258+
getClient()?.addIntegration(integration);
259+
260+
showFeedbackWidget();
261+
262+
expect(toJSON()).toMatchSnapshot();
263+
});
264+
265+
it('the Feedback Button matches the snapshot with default configuration', () => {
266+
mockedIsModalSupported.mockReturnValue(true);
267+
const { toJSON } = render(
268+
<FeedbackWidgetProvider>
269+
<Text>App Components</Text>
270+
</FeedbackWidgetProvider>
271+
);
272+
273+
showFeedbackButton();
274+
275+
expect(toJSON()).toMatchSnapshot();
276+
});
277+
278+
it('the Feedback Button matches the snapshot with custom light theme', () => {
279+
mockedIsModalSupported.mockReturnValue(true);
280+
const { toJSON } = render(
281+
<FeedbackWidgetProvider>
282+
<Text>App Components</Text>
283+
</FeedbackWidgetProvider>
284+
);
285+
286+
const integration = feedbackIntegration({
287+
colorScheme: 'light',
288+
themeLight: {
289+
foreground: '#ff0000',
290+
background: '#00ff00',
291+
},
292+
});
293+
getClient()?.addIntegration(integration);
294+
295+
showFeedbackButton();
296+
297+
expect(toJSON()).toMatchSnapshot();
298+
});
299+
300+
it('the Feedback Button matches the snapshot with custom dark theme', () => {
301+
mockedIsModalSupported.mockReturnValue(true);
302+
const { toJSON } = render(
303+
<FeedbackWidgetProvider>
304+
<Text>App Components</Text>
305+
</FeedbackWidgetProvider>
306+
);
307+
308+
const integration = feedbackIntegration({
309+
colorScheme: 'dark',
310+
themeDark: {
311+
foreground: '#00ff00',
312+
background: '#ff0000',
313+
},
314+
});
315+
getClient()?.addIntegration(integration);
316+
317+
showFeedbackButton();
318+
319+
expect(toJSON()).toMatchSnapshot();
320+
});
207321
});

0 commit comments

Comments
 (0)