Removes first comment body from notes tests

Improves notes unit tests by replacing checking with first comment's body with checking with default / user-specified descriptions. Also, removes test_author unit test, adds setting note's author when checking notification's success and sets first comment type to "opened" in tests with tooltips which require first comment to be "opened".
This commit is contained in:
Nenad Vujicic 2025-03-04 16:12:14 +01:00 committed by Tom Hughes
parent 047e972b2d
commit cc6bfb2c7c
6 changed files with 31 additions and 21 deletions

View file

@ -48,20 +48,29 @@ class NoteTest < ActiveSupport::TestCase
end
def test_description
comment = create(:note_comment)
assert_equal comment.body, comment.note.description
note = create(:note)
assert_equal "Default note's description", note.description
user = create(:user)
comment = create(:note_comment, :author => user)
assert_equal comment.body, comment.note.description
note = create(:note, :description => "Test description #1")
assert_equal "Test description #1", note.description
comment = create(:note_comment)
assert_equal "Default note's description", comment.note.description
comment = create(:note_comment, :note => build(:note, :description => "Test description #2"))
assert_equal "Test description #2", comment.note.description
end
def test_author
user = create(:user)
note = create(:note, :author => user)
assert_equal user, note.author
comment = create(:note_comment)
assert_nil comment.note.author
user = create(:user)
comment = create(:note_comment, :author => user)
comment = create(:note_comment, :author => user, :note => build(:note, :author => user))
assert_equal user, comment.note.author
end