test: Packets error paths
This commit is contained in:
parent
6afeb7a815
commit
dc1b9d8bcb
1 changed files with 16 additions and 0 deletions
|
|
@ -292,6 +292,22 @@ defmodule Aprsme.PacketsTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "store_packet/1 error paths" do
|
||||
test "storage exception path stores a bad packet" do
|
||||
# Send data that causes changeset insertion to fail at the DB level.
|
||||
# raw_packet too long exceeds any reasonable schema constraint, or we
|
||||
# can force a validation error via missing required fields.
|
||||
packet_data = %{
|
||||
sender: "",
|
||||
raw_packet: "BAD"
|
||||
}
|
||||
|
||||
result = Packets.store_packet(packet_data)
|
||||
# Either ValidationError or :storage_exception — both paths log and store BadPacket.
|
||||
assert result == {:error, :validation_error} or result == {:error, :storage_exception}
|
||||
end
|
||||
end
|
||||
|
||||
describe "store_bad_packet/2" do
|
||||
test "stores bad packet from string" do
|
||||
error = %{message: "Parse error", type: "ParseError"}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue