yak(mutation-testing-with-muex-blogex-pure-app-code-1341): mutation testing with muex (blogex + pure app code)
This commit is contained in:
@@ -245,6 +245,24 @@ defmodule Blogex.LinkValidatorTest do
|
||||
end
|
||||
|
||||
describe "validate_body/2" do
|
||||
# The guard is a conjunction, not a disjunction: both arguments must have
|
||||
# the documented types. Mutating `and` to `or` would let a string blog id
|
||||
# (or a non-binary body) through the guard to crash somewhere else, so pin
|
||||
# the contract at the door.
|
||||
test "rejects a non-atom blog id at the function clause guard" do
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
# apply/3 keeps the compiler's type checker quiet: the point is the
|
||||
# runtime guard, and the test deliberately passes an invalid type.
|
||||
apply(LinkValidator, :validate_body, ["Just text, no links.", "engineering"])
|
||||
end
|
||||
end
|
||||
|
||||
test "rejects a non-binary body at the function clause guard" do
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
apply(LinkValidator, :validate_body, [[], :engineering])
|
||||
end
|
||||
end
|
||||
|
||||
test "returns :ok when body has no internal blog links" do
|
||||
body = "Just text, no links."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user