Skip to content

Commit

Permalink
Explain tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-imber committed Oct 30, 2024
1 parent d925989 commit c6efb93
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,42 @@ class AffiliateLinksCleanerTest extends AnyFlatSpec with Matchers {
}

"shouldAddAffiliateLinks" should "correctly determine when to add affiliate links" in {

// the switch is respected
shouldAddAffiliateLinks(
switchedOn = false,
None,
Set.empty,
List.empty,
) should be(false)
// affiliate links are not added when showAffiliateLinks is false
shouldAddAffiliateLinks(
switchedOn = true,
Some(false),
Set.empty,
List.empty,
) should be(false)
// affiliate links are added when showAffiliateLinks is true and there are no alwaysOff tags present
shouldAddAffiliateLinks(
switchedOn = true,
Some(true),
Set.empty,
List.empty,
) should be(true)
// affiliate links are not added when showAffiliateLinks is not defined
shouldAddAffiliateLinks(
switchedOn = true,
None,
Set.empty,
List("tech"),
) should be(false)
// affiliate links are not added when an always off tag is present on the article
shouldAddAffiliateLinks(
switchedOn = true,
Some(true),
Set("bereavement"),
List("bereavement"),
) should be(false)
// affiliate links are added when the tags are considered safe
shouldAddAffiliateLinks(
switchedOn = true,
Some(true),
Expand Down

0 comments on commit c6efb93

Please sign in to comment.