@@ -504,6 +504,36 @@ class UsersControllerTest < ActionController::TestCase
504504 assert_select '#sidebar button' , text : 'Authenticate your ORCID'
505505 end
506506
507+ test 'should show link orcid button if own profile and orcid currently blank' do
508+ user = users ( :private_user )
509+ user . profile . update_column ( :orcid , nil )
510+
511+ refute user . profile . orcid . present?
512+ refute user . profile . orcid_authenticated?
513+
514+ sign_in user
515+
516+ get :show , params : { id : user }
517+
518+ assert_response :success
519+ assert_select '#sidebar button' , text : 'Link your ORCID'
520+ end
521+
522+ test 'should not show authenticate orcid button if feature disabled' do
523+ Rails . application . config . secrets . stub ( :orcid , nil ) do
524+ user = users ( :private_user )
525+ assert user . profile . orcid . present?
526+ refute user . profile . orcid_authenticated?
527+
528+ sign_in user
529+
530+ get :show , params : { id : user }
531+
532+ assert_response :success
533+ assert_select '#sidebar button' , text : 'Authenticate your ORCID' , count : 0
534+ end
535+ end
536+
507537 test 'should not show authenticate orcid button if not own profile' do
508538 user = users ( :private_user )
509539 assert user . profile . orcid . present?
0 commit comments