DEV: fix chat message grace edit period flaky (#28095)

The message grace edit window (10 seconds) was too short after freezing time, possibly causing the test to fail occasionally if the record is not updated within 5 seconds.
This commit is contained in:
David Battersby 2024-07-26 18:16:17 +04:00 committed by GitHub
parent 56ecbcb8c9
commit 6f2f34f786
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -871,7 +871,7 @@ RSpec.describe Chat::UpdateMessage do
end
before do
SiteSetting.chat_editing_grace_period = 10
SiteSetting.chat_editing_grace_period = 30
SiteSetting.chat_editing_grace_period_max_diff_low_trust = 10
SiteSetting.chat_editing_grace_period_max_diff_high_trust = 40
@ -949,7 +949,7 @@ RSpec.describe Chat::UpdateMessage do
let(:low_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_low_trust }
let(:high_trust_char_limit) { SiteSetting.chat_editing_grace_period_max_diff_high_trust }
xit "does not create a revision when under (n) seconds" do
it "does not create a revision when under (n) seconds" do
freeze_time 5.seconds.from_now
message_1.update!(message: "hello")
@ -963,7 +963,7 @@ RSpec.describe Chat::UpdateMessage do
end
it "creates a revision when over (n) seconds" do
freeze_time 30.seconds.from_now
freeze_time 40.seconds.from_now
message_1.update!(message: "welcome")
expect { result }.to change { Chat::MessageRevision.count }.by(1)