From e77e0107488da17479f700b84d2aed1ad6362032 Mon Sep 17 00:00:00 2001 From: Henry Orozco Date: Wed, 27 Nov 2024 16:37:30 -0600 Subject: [PATCH] fix: tests --- src/components/molecules/buttonShareRecording.graphql | 5 +++++ src/components/molecules/socialLogin.tsx | 11 +++++------ src/components/organisms/slider.spec.tsx | 2 +- src/components/templates/andMiniplayer.spec.tsx | 2 ++ src/containers/discover/index.spec.tsx | 2 +- src/containers/home.spec.tsx | 8 ++++---- src/containers/presenter/recordings.spec.tsx | 2 +- src/containers/series/detail.spec.tsx | 2 +- src/containers/series/list.spec.tsx | 2 +- src/containers/sermon/list.all.spec.tsx | 4 ++-- src/containers/song/albums/list.spec.tsx | 2 +- src/containers/song/books/detail.spec.tsx | 4 ++-- src/containers/sponsor/detail.spec.tsx | 2 +- src/containers/sponsor/series.spec.tsx | 2 +- src/containers/sponsor/teachings.spec.tsx | 2 +- src/containers/story/albums/list.spec.tsx | 2 +- 16 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/components/molecules/buttonShareRecording.graphql b/src/components/molecules/buttonShareRecording.graphql index 4423b40a6..fcd511fef 100644 --- a/src/components/molecules/buttonShareRecording.graphql +++ b/src/components/molecules/buttonShareRecording.graphql @@ -1,3 +1,8 @@ fragment buttonShareRecording on Recording { + id + title shareUrl + speakers: persons(role: SPEAKER) { + name + } } diff --git a/src/components/molecules/socialLogin.tsx b/src/components/molecules/socialLogin.tsx index c105e1782..03111f124 100644 --- a/src/components/molecules/socialLogin.tsx +++ b/src/components/molecules/socialLogin.tsx @@ -39,9 +39,8 @@ export default function SocialLogin({ const { mutate: mutateSocial, isSuccess: isSuccessSocial } = useRegisterSocialMutation({ onSuccess: async (response, variables) => { - const result = response?.loginSocial; - const errors = result.errors; - const token = result.authenticatedUser?.sessionToken; + const errors = response?.loginSocial.errors || []; + const token = response?.loginSocial.authenticatedUser?.sessionToken; if (token && !errors.length) { setSessionToken(token); @@ -52,14 +51,14 @@ export default function SocialLogin({ email: user?.email, source: 'Login', }); - if (result.isNewUser) { + if (response?.loginSocial.isNewUser) { gtmPushEvent('sign_up', { - sign_up_method: variables.socialName, + sign_up_method: variables?.socialName, user_id: user?.id, }); } else { gtmPushEvent('sign_in', { - sign_in_method: variables.socialName, + sign_in_method: variables?.socialName, user_id: user?.id, }); } diff --git a/src/components/organisms/slider.spec.tsx b/src/components/organisms/slider.spec.tsx index e39d26e74..a4b1a0873 100644 --- a/src/components/organisms/slider.spec.tsx +++ b/src/components/organisms/slider.spec.tsx @@ -33,7 +33,7 @@ describe('card slider', () => { { title: 'the_recording_title', canonicalPath: 'the_recording_path', - persons: [], + speakers: [], } as any } /> diff --git a/src/components/templates/andMiniplayer.spec.tsx b/src/components/templates/andMiniplayer.spec.tsx index 3049aadf4..bc9c1f143 100644 --- a/src/components/templates/andMiniplayer.spec.tsx +++ b/src/components/templates/andMiniplayer.spec.tsx @@ -106,6 +106,7 @@ describe('miniplayer template', () => { { title: 'the_recording_title', canonicalPath: 'the_recording_path', + speakers: [], } as any, 'the_recording_id', ); @@ -132,6 +133,7 @@ describe('miniplayer template', () => { { title: 'the_recording_title', canonicalPath: 'the_recording_path', + speakers: [], } as any, 'the_recording_id', ); diff --git a/src/containers/discover/index.spec.tsx b/src/containers/discover/index.spec.tsx index 4fed3704b..dec546aef 100644 --- a/src/containers/discover/index.spec.tsx +++ b/src/containers/discover/index.spec.tsx @@ -51,7 +51,7 @@ const recentTeaching = { title: 'recent_sermon_title', canonicalPath: 'the_sermon_path', recordingContentType: RecordingContentType.Sermon, - persons: [], + speakers: [], }; const recentTeachingsDefaults = { diff --git a/src/containers/home.spec.tsx b/src/containers/home.spec.tsx index 7a5082469..d9825e405 100644 --- a/src/containers/home.spec.tsx +++ b/src/containers/home.spec.tsx @@ -23,7 +23,7 @@ const audiobookTrack = { title: 'the_audiobook_track_title', canonicalPath: 'the_audiobook_track_path', recordingContentType: RecordingContentType.AudiobookTrack, - persons: [ + speakers: [ { id: 'the_audiobook_track_person_id', canonicalPath: 'the_person_path', @@ -56,7 +56,7 @@ const song = { title: 'the_song_title', canonicalPath: 'the_song_path', recordingContentType: RecordingContentType.MusicTrack, - persons: [ + speakers: [ { id: 'the_song_person_id', canonicalPath: 'the_person_path', @@ -89,7 +89,7 @@ const story = { canonicalPath: 'the_story_path', recordingContentType: RecordingContentType.Story, duration: 21 * 60, - persons: [ + speakers: [ { id: 'the_story_person_id', canonicalPath: 'the_person_path', @@ -125,7 +125,7 @@ const recording = { title: 'the_recording_title', canonicalPath: 'the_recording_path', recordingContentType: RecordingContentType.Sermon, - persons: [ + speakers: [ { id: 'the_recording_person_id', canonicalPath: 'the_person_path', diff --git a/src/containers/presenter/recordings.spec.tsx b/src/containers/presenter/recordings.spec.tsx index 154584e45..53b7ae4f5 100644 --- a/src/containers/presenter/recordings.spec.tsx +++ b/src/containers/presenter/recordings.spec.tsx @@ -33,7 +33,7 @@ function loadData() { title: 'the_recording_title', canonicalPath: 'the_recording_path', recordingContentType: RecordingContentType.Sermon, - persons: [], + speakers: [], recordings: { aggregate: { count: 0, diff --git a/src/containers/series/detail.spec.tsx b/src/containers/series/detail.spec.tsx index 6ae0f222c..4d948d5f8 100644 --- a/src/containers/series/detail.spec.tsx +++ b/src/containers/series/detail.spec.tsx @@ -48,7 +48,7 @@ const loadData = buildLoader(GetSeriesDetailPageDataDocument, { title: 'the_recording_title', canonicalPath: 'the_recording_path', recordingContentType: RecordingContentType.Sermon, - persons: [], + speakers: [], }, ], aggregate: { count: 1 }, diff --git a/src/containers/series/list.spec.tsx b/src/containers/series/list.spec.tsx index e08b6ca9e..8f1d0d701 100644 --- a/src/containers/series/list.spec.tsx +++ b/src/containers/series/list.spec.tsx @@ -25,7 +25,7 @@ const loadData = buildLoader(GetSeriesListPageDataDocument, { title: 'the_series_title', contentType: SequenceContentType.Series, canonicalPath: 'the_series_path', - speakers: [], + sequenceSpeakers: [], allRecordings: { aggregate: { count: 0, diff --git a/src/containers/sermon/list.all.spec.tsx b/src/containers/sermon/list.all.spec.tsx index bd5223e4d..c25d46786 100644 --- a/src/containers/sermon/list.all.spec.tsx +++ b/src/containers/sermon/list.all.spec.tsx @@ -50,7 +50,7 @@ export function loadSermonListData({ canonicalPath: 'the_sermon_path', recordingContentType: RecordingContentType.Sermon, videoFiles: [], - persons: [], + speakers: [], }, ], aggregate: { @@ -301,7 +301,7 @@ describe('sermons list page', () => { title: 'the_sermon_title', canonicalPath: 'the_sermon_path', recordingContentType: RecordingContentType.Sermon, - persons: [ + speakers: [ { id: 'the_id', name: 'the_name', diff --git a/src/containers/song/albums/list.spec.tsx b/src/containers/song/albums/list.spec.tsx index 41c19b4cd..027f71751 100644 --- a/src/containers/song/albums/list.spec.tsx +++ b/src/containers/song/albums/list.spec.tsx @@ -28,7 +28,7 @@ function loadData() { imageWithFallback: { url: 'the_album_cover', }, - speakers: { + sequenceSpeakers: { nodes: [], }, sponsor: { diff --git a/src/containers/song/books/detail.spec.tsx b/src/containers/song/books/detail.spec.tsx index 432fc0d29..7a255b5c2 100644 --- a/src/containers/song/books/detail.spec.tsx +++ b/src/containers/song/books/detail.spec.tsx @@ -25,7 +25,7 @@ function loadData() { canonicalPath: 'first_song_path', contentType: RecordingContentType.MusicTrack, shareUrl: 'first_song_shareurl', - persons: [], + speakers: [], }, { id: 'second_song_id', @@ -33,7 +33,7 @@ function loadData() { canonicalPath: 'second_song_path', contentType: RecordingContentType.MusicTrack, shareUrl: 'second_song_shareurl', - persons: [], + speakers: [], }, ], }, diff --git a/src/containers/sponsor/detail.spec.tsx b/src/containers/sponsor/detail.spec.tsx index 606255a26..acf593b7d 100644 --- a/src/containers/sponsor/detail.spec.tsx +++ b/src/containers/sponsor/detail.spec.tsx @@ -49,7 +49,7 @@ function loadData() { count: 1, }, }, - speakers: [], + sequenceSpeakers: [], }, ], }, diff --git a/src/containers/sponsor/series.spec.tsx b/src/containers/sponsor/series.spec.tsx index f05cd2183..e750d75c5 100644 --- a/src/containers/sponsor/series.spec.tsx +++ b/src/containers/sponsor/series.spec.tsx @@ -33,7 +33,7 @@ const loadData = buildLoader(GetSponsorSeriesPageDataDocument, { title: 'the_series_title', canonicalPath: 'the_series_path', contentType: SequenceContentType.Series, - speakers: [], + sequenceSpeakers: { nodes: [] }, allRecordings: { aggregate: { count: 0, diff --git a/src/containers/sponsor/teachings.spec.tsx b/src/containers/sponsor/teachings.spec.tsx index 472cb71e3..e4f578429 100644 --- a/src/containers/sponsor/teachings.spec.tsx +++ b/src/containers/sponsor/teachings.spec.tsx @@ -32,7 +32,7 @@ const loadData = buildLoader(GetSponsorTeachingsPageDataDocument, { title: 'the_recording_title', recordingContentType: RecordingContentType.Sermon, canonicalPath: 'the_recording_path', - persons: [], + speakers: [], }, ], aggregate: { diff --git a/src/containers/story/albums/list.spec.tsx b/src/containers/story/albums/list.spec.tsx index ce1732d70..87ec72475 100644 --- a/src/containers/story/albums/list.spec.tsx +++ b/src/containers/story/albums/list.spec.tsx @@ -26,7 +26,7 @@ const loadData = buildLoader(GetStoriesAlbumsPageDataDocument, { title: 'the_story_title', canonicalPath: 'the_story_path', contentType: SequenceContentType.StorySeason, - speakers: [], + sequenceSpeakers: [], allRecordings: { aggregate: { count: 0,