From 8e7a69415405ebbd8a239eb759fdbb831c75069b Mon Sep 17 00:00:00 2001 From: Nenad Vujicic Date: Thu, 26 Dec 2024 19:39:30 +0100 Subject: [PATCH] Updated tests to work with the latest changes Updated tests to specify note's description while creating note and opening comment to have empty body (to follow the latest scheme). --- test/controllers/api/notes_controller_test.rb | 10 +++++----- test/system/index_test.rb | 8 ++++---- test/system/report_note_test.rb | 4 ++-- test/system/report_user_test.rb | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/controllers/api/notes_controller_test.rb b/test/controllers/api/notes_controller_test.rb index 5f69e6a2ac0..0779fb4b9d3 100644 --- a/test/controllers/api/notes_controller_test.rb +++ b/test/controllers/api/notes_controller_test.rb @@ -664,10 +664,10 @@ def test_show_success end def test_show_hidden_comment - note_with_hidden_comment = create(:note) do |note| - create(:note_comment, :note => note, :body => "Valid comment for hidden note") - create(:note_comment, :note => note, :visible => false) - create(:note_comment, :note => note, :body => "Another valid comment for hidden note") + note_with_hidden_comment = create(:note, :description => "Test Note description") do |note| + create(:note_comment, :note => note, :event => "opened", :body => "") + create(:note_comment, :note => note, :event => "commented", :visible => false, :body => "Valid comment for hidden note") + create(:note_comment, :note => note, :event => "commented", :body => "Another valid comment for hidden note") end get api_note_path(note_with_hidden_comment, :format => "json") @@ -677,7 +677,7 @@ def test_show_hidden_comment assert_equal "Feature", js["type"] assert_equal note_with_hidden_comment.id, js["properties"]["id"] assert_equal 2, js["properties"]["comments"].count - assert_equal "Valid comment for hidden note", js["properties"]["comments"][0]["text"] + assert_equal "Test Note description", js["properties"]["comments"][0]["text"] assert_equal "Another valid comment for hidden note", js["properties"]["comments"][1]["text"] end diff --git a/test/system/index_test.rb b/test/system/index_test.rb index 2944b817edc..7a134dc6913 100644 --- a/test/system/index_test.rb +++ b/test/system/index_test.rb @@ -56,11 +56,11 @@ class IndexTest < ApplicationSystemTestCase test "can navigate from hidden note to visible note" do sign_in_as(create(:moderator_user)) - hidden_note = create(:note, :status => "hidden") - create(:note_comment, :note => hidden_note, :body => "this-is-a-hidden-note") + hidden_note = create(:note, :status => "hidden", :description => "this-is-a-hidden-note") + create(:note_comment, :note => hidden_note, :event => "opened", :body => "") position = (1.003 * GeoRecord::SCALE).to_i - visible_note = create(:note, :latitude => position, :longitude => position) - create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note") + visible_note = create(:note, :latitude => position, :longitude => position, :description => "this-is-a-visible-note") + create(:note_comment, :note => visible_note, :event => "opened", :body => "") visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during note_path(hidden_note) visit note_path(hidden_note) diff --git a/test/system/report_note_test.rb b/test/system/report_note_test.rb index 79894eb897d..13000a0d1ca 100644 --- a/test/system/report_note_test.rb +++ b/test/system/report_note_test.rb @@ -2,9 +2,9 @@ class ReportNoteTest < ApplicationSystemTestCase def test_no_link_when_not_logged_in - note = create(:note_with_comments) + note = create(:note_with_comments, :description => "TD 1") visit note_path(note) - assert_content note.comments.first.body + assert_content "TD 1" assert_no_content I18n.t("notes.show.report") end diff --git a/test/system/report_user_test.rb b/test/system/report_user_test.rb index 7a9e800c8c0..4df2b869a22 100644 --- a/test/system/report_user_test.rb +++ b/test/system/report_user_test.rb @@ -2,9 +2,9 @@ class ReportUserTest < ApplicationSystemTestCase def test_no_link_when_not_logged_in - note = create(:note_with_comments) + note = create(:note_with_comments, :description => "TD 1") visit note_path(note) - assert_content note.comments.first.body + assert_content "TD 1" assert_no_content I18n.t("users.show.report") end