Commit 6f3184c4 authored by David Lucadou's avatar David Lucadou

Added more tests

I added more tests to chat logs search to account for new functionality
with regards to negative message IDs that go below the range of ints,
and added more tests to user reports search.
The channel, sender, and message ID tests were copied directly from the
chat logs search tests and modified to fit, and they work fine.
It's surprising the bugs you find when you write out automated tests
that you do not realize when manually testing things.
parent db01a28f
Pipeline #60374522 passed with stage
in 7 minutes and 50 seconds
......@@ -1188,12 +1188,21 @@ RSpec.describe "ChatLogsSearch", type: :request do
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Starting ID must be greater than 0")
# Starting ID -100
advanced_search_with(start_id: -100)
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Starting ID must be greater than 0")
# Starting ID -2147483649 (current min for message ID fields is -2^31,
# or -2147483648)
advanced_search_with(start_id: -2147483649)
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Starting ID must be greater than 0")
end
it "execute an advanced search with a starting ID with a decimal" do
# Positive decimal starting ID
......@@ -1224,21 +1233,30 @@ RSpec.describe "ChatLogsSearch", type: :request do
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Starting ID must be less than or equal to 2147483647")
end
it "execute an advanced search with a ending ID less than 1" do
it "execute an advanced search with an ending ID less than 1" do
# Ending ID 0
advanced_search_with(end_id: 0)
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Ending ID must be greater than 0")
# Ending ID -100
advanced_search_with(end_id: -100)
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Ending ID must be greater than 0")
# Ending ID -2147483649 (current min for message ID fields is -2^31,
# or -2147483648)
advanced_search_with(end_id: -2147483649)
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Ending ID must be greater than 0")
end
it "execute an advanced search with a ending ID with a decimal" do
it "execute an advanced search with an ending ID with a decimal" do
# Positive decimal ending ID
advanced_search_with(end_id: 3.14159)
expect(page).to have_current_path(advanced_search_chat_logs_path)
......@@ -1252,14 +1270,14 @@ RSpec.describe "ChatLogsSearch", type: :request do
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Ending ID must be an integer value greater than 0")
end
it "execute an advanced search with a ending ID with a non-numeric value" do
it "execute an advanced search with an ending ID with a non-numeric value" do
advanced_search_with(end_id: 'ggggggg')
expect(page).to have_current_path(advanced_search_chat_logs_path)
expect(page).to have_content("Failed to execute search, see errors below")
expect(page).to have_content("1 error prohibited your search from being executed")
expect(page).to have_content("Ending ID must be an integer value greater than 0")
end
it "execute an advanced search with a ending ID greater than 2147483647" do
it "execute an advanced search with an ending ID greater than 2147483647" do
# 2^31 = 2147483648, the current max for the message ID fields
advanced_search_with(end_id: 2147483648)
expect(page).to have_current_path(advanced_search_chat_logs_path)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment