Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alangumer committed Nov 27, 2024
1 parent 674e593 commit e77e010
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 24 deletions.
5 changes: 5 additions & 0 deletions src/components/molecules/buttonShareRecording.graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
fragment buttonShareRecording on Recording {
id
title
shareUrl
speakers: persons(role: SPEAKER) {
name
}
}
11 changes: 5 additions & 6 deletions src/components/molecules/socialLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/organisms/slider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('card slider', () => {
{
title: 'the_recording_title',
canonicalPath: 'the_recording_path',
persons: [],
speakers: [],
} as any
}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/components/templates/andMiniplayer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ describe('miniplayer template', () => {
{
title: 'the_recording_title',
canonicalPath: 'the_recording_path',
speakers: [],
} as any,
'the_recording_id',
);
Expand All @@ -132,6 +133,7 @@ describe('miniplayer template', () => {
{
title: 'the_recording_title',
canonicalPath: 'the_recording_path',
speakers: [],
} as any,
'the_recording_id',
);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/discover/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const recentTeaching = {
title: 'recent_sermon_title',
canonicalPath: 'the_sermon_path',
recordingContentType: RecordingContentType.Sermon,
persons: [],
speakers: [],
};

const recentTeachingsDefaults = {
Expand Down
8 changes: 4 additions & 4 deletions src/containers/home.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/containers/presenter/recordings.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function loadData() {
title: 'the_recording_title',
canonicalPath: 'the_recording_path',
recordingContentType: RecordingContentType.Sermon,
persons: [],
speakers: [],
recordings: {
aggregate: {
count: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/series/detail.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const loadData = buildLoader(GetSeriesDetailPageDataDocument, {
title: 'the_recording_title',
canonicalPath: 'the_recording_path',
recordingContentType: RecordingContentType.Sermon,
persons: [],
speakers: [],
},
],
aggregate: { count: 1 },
Expand Down
2 changes: 1 addition & 1 deletion src/containers/series/list.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/containers/sermon/list.all.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function loadSermonListData({
canonicalPath: 'the_sermon_path',
recordingContentType: RecordingContentType.Sermon,
videoFiles: [],
persons: [],
speakers: [],
},
],
aggregate: {
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/containers/song/albums/list.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function loadData() {
imageWithFallback: {
url: 'the_album_cover',
},
speakers: {
sequenceSpeakers: {
nodes: [],
},
sponsor: {
Expand Down
4 changes: 2 additions & 2 deletions src/containers/song/books/detail.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ function loadData() {
canonicalPath: 'first_song_path',
contentType: RecordingContentType.MusicTrack,
shareUrl: 'first_song_shareurl',
persons: [],
speakers: [],
},
{
id: 'second_song_id',
title: 'second_song_title',
canonicalPath: 'second_song_path',
contentType: RecordingContentType.MusicTrack,
shareUrl: 'second_song_shareurl',
persons: [],
speakers: [],
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/containers/sponsor/detail.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function loadData() {
count: 1,
},
},
speakers: [],
sequenceSpeakers: [],
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/containers/sponsor/series.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/containers/sponsor/teachings.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const loadData = buildLoader(GetSponsorTeachingsPageDataDocument, {
title: 'the_recording_title',
recordingContentType: RecordingContentType.Sermon,
canonicalPath: 'the_recording_path',
persons: [],
speakers: [],
},
],
aggregate: {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/story/albums/list.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e77e010

Please sign in to comment.