Skip to content

Commit

Permalink
Updated tests to work with the latest changes
Browse files Browse the repository at this point in the history
Updated tests to specify note's description while creating note and
opening comment to have empty body (like in the latest scheme).
  • Loading branch information
nenad-vujicic committed Dec 27, 2024
1 parent 8d3abf7 commit bc2c8a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions test/controllers/api/notes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 => "Valid comment for hidden note")
create(:note_comment, :note => note, :event => "commented", :visible => false)
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")
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions test/system/index_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/system/report_note_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/system/report_user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc2c8a5

Please sign in to comment.