From fec50571ef2bb37e8d3136182fd4458b4a5f6d0d Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Mon, 23 Mar 2020 13:35:20 +0000 Subject: [PATCH] Fix tests --- app/talk/discussion-preview.cjsx | 8 ++++---- app/talk/discussion-preview.spec.js | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/talk/discussion-preview.cjsx b/app/talk/discussion-preview.cjsx index 89618685e7..0f8a8a13e1 100644 --- a/app/talk/discussion-preview.cjsx +++ b/app/talk/discussion-preview.cjsx @@ -19,15 +19,15 @@ module.exports = createReactClass project: {} discussionLink: -> - {discussion} = @props - baseURL = @props.project?._type._name + {discussion, project} = @props + baseURL = project?._type?._name if (baseURL && @props.params?.owner and @props.params?.name) # get from url if possible {owner, name} = @props.params "/#{baseURL}/#{owner}/#{name}/talk/#{discussion.board_id}/#{discussion.id}" - else if (baseURL && @props.project.slug) # otherwise fetch from project - "/#{baseURL}/#{@props.project.slug}/talk/#{discussion.board_id}/#{discussion.id}" + else if (baseURL && project.slug) # otherwise fetch from project + "/#{baseURL}/#{project.slug}/talk/#{discussion.board_id}/#{discussion.id}" else # link to zooniverse main talk "/talk/#{discussion.board_id}/#{discussion.id}" diff --git a/app/talk/discussion-preview.spec.js b/app/talk/discussion-preview.spec.js index bab0b318ba..927bca0b87 100644 --- a/app/talk/discussion-preview.spec.js +++ b/app/talk/discussion-preview.spec.js @@ -5,6 +5,9 @@ import { shallow } from 'enzyme'; import DiscussionPreview from './discussion-preview'; const validProject = { + _type: { + _name: 'projects' + }, id: 34, slug: 'test/project' };