from db.brochure_type_key_taxonomy import taxonomy_targets_for_type_key


def test_taxonomy_targets_for_base_basic_type_key():
    targets = taxonomy_targets_for_type_key("base-cabinets.basic-base")
    assert targets["category_path_labels"] == [
        "Kitchen Cabinets",
        "Base Cabinets",
        "Basic Base",
    ]
    assert targets["category_path_slug"] == "kitchen-cabinets/base-cabinets/basic-base"
    assert targets["shopping_l1"] == "base-cabinets"
    assert targets["shopping_l2"] == "base-cabinets/basic-base"
    assert targets["shopping_collection_attribute_code"] == "shopping_collection"


def test_taxonomy_targets_for_legacy_wall_key():
    targets = taxonomy_targets_for_type_key("wall.basic.1-door")
    assert targets["category_path_labels"] == [
        "Kitchen Cabinets",
        "Wall Cabinets",
        "Basic Wall",
    ]
    assert targets["shopping_l1"] == "wall-cabinets"
    assert targets["shopping_l2"] == "wall-cabinets/basic-wall"
