Created
January 26, 2022 21:37
-
-
Save jimarnold/0199868a6d1bcfe2392669355a8b945f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/scala/com/etsy/kb/service/common/model/ott/TaxonomyNode.scala b/src/main/scala/com/etsy/kb/service/common/model/ott/TaxonomyNode.scala | |
index b31bdb0a..3df413cb 100644 | |
--- a/src/main/scala/com/etsy/kb/service/common/model/ott/TaxonomyNode.scala | |
+++ b/src/main/scala/com/etsy/kb/service/common/model/ott/TaxonomyNode.scala | |
@@ -51,9 +51,9 @@ object TaxonomyNode { | |
* @return whether or not the node is visible | |
*/ | |
def isVisible(node: TaxonomyNode): Boolean = { | |
- // Nodes are always visible unless they have a seller_node_visibility field AND | |
- // it does not contain the value "VISIBLE". I don't make the rules. | |
- node.seller_node_visibility.forall(_.contains("VISIBLE")) | |
+ // Nodes are always visible unless they have an ott_maps_to_field | |
+ // ie they are mapped to (masked by) another node. | |
+ node.ott_maps_to.isEmpty | |
} | |
} | |
diff --git a/src/test/scala/com/etsy/kb/service/common/model/TaxonomyNodeSpec.scala b/src/test/scala/com/etsy/kb/service/common/model/TaxonomyNodeSpec.scala | |
index f804de91..597918df 100644 | |
--- a/src/test/scala/com/etsy/kb/service/common/model/TaxonomyNodeSpec.scala | |
+++ b/src/test/scala/com/etsy/kb/service/common/model/TaxonomyNodeSpec.scala | |
@@ -6,25 +6,17 @@ import org.scalatest.matchers.should.Matchers | |
class TaxonomyNodeSpec extends AnyFreeSpec with Matchers with OptionValues { | |
"TaxonomyNode#isVisible" - { | |
- "should be visible if there is no seller_node_visibility field" in { | |
+ "should be visible if there is no ott_maps_to field" in { | |
val node = buildTaxonomyNode(None) | |
TaxonomyNode.isVisible(node) shouldBe true | |
} | |
- "should be visible if the seller_node_visibility field contains VISIBLE" in { | |
- val node = buildTaxonomyNode(Some(Seq("VISIBLE"))) | |
- TaxonomyNode.isVisible(node) shouldBe true | |
- } | |
- "should not be visible if the seller_node_visibility field contains something other than VISIBLE" in { | |
- val node = buildTaxonomyNode(Some(Seq("NOT_VISIBLE"))) | |
- TaxonomyNode.isVisible(node) shouldBe false | |
- } | |
- "should not be visible if the seller_node_visibility field contains an empty sequence" in { | |
- val node = buildTaxonomyNode(Some(Seq.empty)) | |
+ "should not be visible if the ott_maps_to field exists" in { | |
+ val node = buildTaxonomyNode(Some(TaxonomyOttMapping(Option.empty[Map[String, Seq[Int]]], 0))) | |
TaxonomyNode.isVisible(node) shouldBe false | |
} | |
} | |
- private def buildTaxonomyNode(seller_node_visibility: Option[Seq[String]]): TaxonomyNode = { | |
+ private def buildTaxonomyNode(ott_maps_to: Option[TaxonomyOttMapping]): TaxonomyNode = { | |
TaxonomyNode( | |
path = "driving_gloves", | |
attributeValueSets = Some(Seq()), | |
@@ -40,8 +32,8 @@ class TaxonomyNodeSpec extends AnyFreeSpec with Matchers with OptionValues { | |
avsOrder = None, | |
description = None, | |
explicitSearchTerms = None, | |
- ott_maps_to = None, | |
- seller_node_visibility = seller_node_visibility, | |
+ ott_maps_to = ott_maps_to, | |
+ seller_node_visibility = None, | |
short_name = None | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment