feat: add query test

This commit is contained in:
tomaz jejcic 2023-11-06 11:10:43 +01:00
parent b1b492bea0
commit d53cdac471
3 changed files with 1117 additions and 0 deletions

937
tests/data/attributes.json Normal file
View File

@ -0,0 +1,937 @@
{
"attributeFurnitureProductionType": {
"id": "attributeFurnitureProductionType",
"type": "enums",
"enumStrings": {
"Maschinell": "Maschinell",
"Handgefertigt": "Handgefertigt",
"Maschinengewebt / Bedruckt": "Maschinengewebt / Bedruckt",
"Maschinell hergestellt": "Maschinell hergestellt",
"Maschinengewebt": "Maschinengewebt",
"Gegerbt": "Gegerbt",
"Handgetuftet": "Handgetuftet",
"Handgewebt": "Handgewebt",
"Getuftet": "Getuftet",
"Gewebt": "Gewebt",
"Handgeknüpft": "Handgeknüpft"
},
"meta": {
"label": {
"de": "Herstellungsart"
},
"description": {
"de": "describes the manufacturing method"
}
}
},
"attributeShoesAndAccessoriesBooteesType": {
"id": "attributeShoesAndAccessoriesBooteesType",
"type": "enums",
"enumStrings": {
"Trachtenstiefeletten": "Trachtenstiefeletten",
"Klassische Stiefeletten": "Klassische Stiefeletten",
"Schnürstiefeletten": "Schnürstiefeletten",
"Winterstiefeletten": "Winterstiefeletten",
"Ankle Boots": "Ankle Boots",
"Biker Boots": "Biker Boots",
"Biker-Stiefeletten": "Biker-Stiefeletten",
"Cowboy-Stiefeletten": "Cowboy-Stiefeletten",
"Chelsea Boots": "Chelsea Boots"
},
"meta": {
"label": {
"de": "Boots \u0026 Stiefeletten"
},
"description": {
"de": "this describes boot and bootlace type of shoes"
}
},
"metaValues": {
"main": {
"label": {
"de": "Boots \u0026 Stiefeletten"
}
}
}
},
"attributeGenericLeatherType": {
"id": "attributeGenericLeatherType",
"type": "enums",
"enumStrings": {
"Bisonleder": "Bisonleder",
"Glattleder": "Glattleder",
"Schafsleder": "Schafsleder",
"Yakleder": "Yakleder",
"Lackleder": "Lackleder",
"Nubukleder": "Nubukleder",
"Nappaleder": "Nappaleder",
"Rindsleder": "Rindsleder",
"Kunstleder": "Kunstleder",
"Saffianoleder": "Saffianoleder",
"Ziegenleder": "Ziegenleder",
"Büffelleder": "Büffelleder",
"Kalbsleder": "Kalbsleder",
"Wildleder": "Wildleder",
"Schweinsleder": "Schweinsleder",
"Kamelleder": "Kamelleder",
"Lammleder": "Lammleder",
"Veloursleder": "Veloursleder"
},
"meta": {
"label": {
"de": "Lederart"
},
"description": {
"de": "no description for attributeGenericLeatherType"
}
},
"metaValues": {
"main": {
"label": {
"de": "Lederart"
}
}
}
},
"attributeHealthAndPersonalCareElectricBabyCareEquipmentType": {
"id": "attributeHealthAndPersonalCareElectricBabyCareEquipmentType",
"type": "enums",
"enumStrings": {
"Flaschenwärmer": "Flaschenwärmer",
"Milchpumpe": "Milchpumpe",
"Nahrungszubereiter": "Nahrungszubereiter",
"Reise-Flaschenwärmer": "Reise-Flaschenwärmer",
"Sets": "Sets",
"Sterilisator": "Sterilisator",
"Babykostwärmer": "Babykostwärmer"
},
"meta": {
"label": {
"de": "Elektrische Babypflegegeräte und Pumpen-Art"
},
"description": {
"de": "tbd"
}
}
},
"attributeHouseholdElectronicsClimateClass": {
"id": "attributeHouseholdElectronicsClimateClass",
"type": "enums",
"enumStrings": {
"SN +10°C bis +32°C": "SN +10°C bis +32°C",
"ST +16°C bis +38°C": "ST +16°C bis +38°C",
"T +16°C bis +43°C": "T +16°C bis +43°C",
"N +16°C bis +32°C": "N +16°C bis +32°C"
},
"meta": {
"label": {
"de": "Klimaklasse"
},
"description": {
"de": "This describes the climate class of a fridge or freezer."
}
}
},
"attributeSportsBicycleAccessoriesType": {
"id": "attributeSportsBicycleAccessoriesType",
"type": "enums",
"enumStrings": {
"Gepäckträger": "Gepäckträger",
"Lenkerband": "Lenkerband",
"Kamerazubehör": "Kamerazubehör",
"Rollentrainer": "Rollentrainer",
"Lenkergriff": "Lenkergriff",
"Fahrradklingel": "Fahrradklingel",
"Werkzeug und Reparatur": "Werkzeug und Reparatur",
"Kinderfahrradanhänger": "Kinderfahrradanhänger",
"Fahrradschloss": "Fahrradschloss",
"Fahrradcomputer": "Fahrradcomputer",
"Leistungsmesser": "Leistungsmesser",
"Fahrrad-Halterung": "Fahrrad-Halterung",
"Fahrrad-Pumpe": "Fahrrad-Pumpe",
"Sicherheit": "Sicherheit",
"Fahrrad-Anhänger": "Fahrrad-Anhänger",
"Fahrradbeleuchtung": "Fahrradbeleuchtung",
"Fahrrad-Kindersitz": "Fahrrad-Kindersitz",
"Fahrrad-Korb": "Fahrrad-Korb",
"Warnweste": "Warnweste",
"Anbauteil": "Anbauteil",
"Flaschenhalter": "Flaschenhalter"
},
"meta": {
"label": {
"de": "Fahrrad-Zubehör-Art"
},
"description": {
"de": "tbd"
}
},
"metaValues": {
"main": {
"label": {
"de": "Fahrrad-Zubehör-Art"
}
}
}
},
"attributeSportsBallType": {
"id": "attributeSportsBallType",
"type": "enums",
"enumStrings": {
"Therapieball": "Therapieball",
"Wasserball": "Wasserball",
"Beachvolleyball": "Beachvolleyball",
"Hallenball": "Hallenball",
"Futsalball": "Futsalball",
"Miniball": "Miniball",
"Gymnastikball": "Gymnastikball",
"Trainingsball": "Trainingsball",
"Freizeitball": "Freizeitball",
"Beach-Ball": "Beach-Ball",
"Softball": "Softball",
"Football": "Football",
"High Bounce Ball": "High Bounce Ball",
"Squashball": "Squashball",
"Reflexball": "Reflexball",
"Tischtennisball": "Tischtennisball",
"Baseball": "Baseball",
"Tennisball": "Tennisball",
"Street-Ball": "Street-Ball",
"Wettkampfball": "Wettkampfball",
"Fußball": "Fußball",
"Medizinball": "Medizinball",
"Volleyball": "Volleyball",
"Badmintonball": "Badmintonball",
"Basketball": "Basketball",
"Golfball": "Golfball"
},
"meta": {
"label": {
"de": "Ball-Art"
},
"description": {
"de": "Attribute describes type of ball"
}
},
"metaValues": {
"main": {
"label": {
"de": "Ball-Art"
}
}
}
},
"attributeHomeAndGardenPartyDecorationEquipmentType": {
"id": "attributeHomeAndGardenPartyDecorationEquipmentType",
"type": "enums",
"enumStrings": {
"Girlanden": "Girlanden",
"Giveaway-Tüten": "Giveaway-Tüten",
"Ballons": "Ballons",
"Glückwunschkarten": "Glückwunschkarten",
"Kuchendekoration": "Kuchendekoration",
"Geschenkartikel": "Geschenkartikel",
"Themenparty-Set": "Themenparty-Set",
"Einladungskarten": "Einladungskarten",
"Einweg-Geschirr (Teller, Becher, Schalen, Besteck)": "Einweg-Geschirr (Teller, Becher, Schalen, Besteck)",
"Luftschlangen": "Luftschlangen",
"Konfetti": "Konfetti",
"Servietten": "Servietten"
},
"meta": {
"label": {
"de": "Partydekorationsausstattungs-Art"
},
"description": {
"de": "tbd"
}
}
},
"attributeToysAndGamesRolePlayingType": {
"id": "attributeToysAndGamesRolePlayingType",
"type": "enums",
"enumStrings": {
"Küche und Essen": "Küche und Essen",
"Superheld": "Superheld",
"Haushalt": "Haushalt",
"Heimwerken": "Heimwerken",
"Kopfbedeckungen": "Kopfbedeckungen",
"Kosmetik": "Kosmetik",
"Kostüme": "Kostüme"
},
"meta": {
"label": {
"de": "Rollenspiele-Art"
},
"description": {
"de": "tbd"
}
}
},
"attributeBeautyCharacteristicsBeauty": {
"id": "attributeBeautyCharacteristicsBeauty",
"type": "enums",
"enumStrings": {
"Vegan": "Vegan",
"Biologische Inhaltsstoffe": "Biologische Inhaltsstoffe",
"Wasserfest": "Wasserfest",
"Augenärztlich getestet": "Augenärztlich getestet",
"Nachhaltig": "Nachhaltig",
"Vegetarisch": "Vegetarisch",
"Bio-zertifiziert": "Bio-zertifiziert",
"100% Natürliche Inhaltsstoffe": "100% Natürliche Inhaltsstoffe",
"Kontaktlinsenverträglich": "Kontaktlinsenverträglich",
"Für empfindliche Augen": "Für empfindliche Augen",
"Clean-Beauty": "Clean-Beauty",
"Hochpigmentiert": "Hochpigmentiert",
"Hypoallergen": "Hypoallergen",
"Biologisch abbaubar": "Biologisch abbaubar",
"Für sensible Haut geeignet": "Für sensible Haut geeignet",
"Dermatologisch getestet": "Dermatologisch getestet",
"Fermentierte Inhaltsstoffe": "Fermentierte Inhaltsstoffe"
},
"meta": {
"label": {
"de": "Eigenschaften"
},
"description": {
"de": "this describes properties of beauty products (e.g. waterproof or vegan)"
}
},
"metaValues": {
"main": {
"label": {
"de": "Eigenschaften"
}
},
"100% Natürliche Inhaltsstoffe": {
"label": {
"de": "100% natürliche Inhaltsstoffe"
}
},
"Fermentierte Inhaltsstoffe": {
"label": {
"de": "Fermentierte Inhaltsstoffe"
}
},
"Biologisch abbaubar": {
"label": {
"de": "Biologisch abbaubar"
}
},
"Clean-Beauty": {
"label": {
"de": "Clean-Beauty"
}
},
"Für empfindliche Augen": {
"label": {
"de": "Für empfindliche Augen"
}
},
"Dermatologisch getestet": {
"label": {
"de": "Dermatologisch getestet"
}
},
"Hypoallergen": {
"label": {
"de": "Hypoallergen"
}
},
"Bio-zertifiziert": {
"label": {
"de": "Bio-zertifiziert"
}
},
"Wasserfest": {
"label": {
"de": "Wasserfest"
}
},
"Vegetarisch": {
"label": {
"de": "Vegetarisch"
}
},
"Für sensible Haut geeignet": {
"label": {
"de": "Für sensible Haut geeignet"
}
},
"Hochpigmentiert": {
"label": {
"de": "Hochpigmentiert"
}
},
"Vegan": {
"label": {
"de": "Vegan"
}
},
"Augenärztlich getestet": {
"label": {
"de": "Augenärztlich getestet"
}
},
"Biologische Inhaltsstoffe": {
"label": {
"de": "Biologische Inhaltsstoffe"
}
},
"Kontaktlinsenverträglich": {
"label": {
"de": "Kontaktlinsenverträglich"
}
},
"Nachhaltig": {
"label": {
"de": "Nachhaltig"
}
}
}
},
"attributeGourmetFoodAndDrinksAggregateStateFoodAndDrinks": {
"id": "attributeGourmetFoodAndDrinksAggregateStateFoodAndDrinks",
"type": "enums",
"enumStrings": {
"Lose Blätter": "Lose Blätter",
"Lose": "Lose",
"Extrakt (löslich)": "Extrakt (löslich)",
"Ganz": "Ganz",
"Ganze Bohnen": "Ganze Bohnen",
"Ganze Körner": "Ganze Körner",
"Gemahlen": "Gemahlen"
},
"meta": {
"label": {
"de": "Aggregatzustand"
},
"description": {
"de": "Attribute describes aggrgate-type of an article"
}
},
"metaValues": {
"main": {
"label": {
"de": "Aggregatzustand"
}
}
}
},
"attributeGenericApplications": {
"id": "attributeGenericApplications",
"type": "enums",
"enumStrings": {
"Stickerei": "Stickerei",
"Bordüre": "Bordüre",
"Pailletten": "Pailletten",
"Perlen": "Perlen",
"Anhänger": "Anhänger",
"Bommel": "Bommel",
"Patch": "Patch",
"Rüschen": "Rüschen",
"Knöpfe": "Knöpfe",
"Paspeln": "Paspeln",
"Blumen": "Blumen",
"Label": "Label",
"Nieten": "Nieten",
"Quaste": "Quaste",
"Ziernähte": "Ziernähte",
"Schleife": "Schleife",
"Strass": "Strass",
"Spitze": "Spitze",
"Wendepailletten": "Wendepailletten",
"Emblem": "Emblem",
"Fransen": "Fransen"
},
"meta": {
"label": {
"de": "Applikationen"
},
"description": {
"de": "Attribute describes special characteristics of an article. e.g fringes,pearls...."
}
},
"metaValues": {
"main": {
"label": {
"de": "Applikationen"
}
}
}
},
"attributeGenericChargingCycles": {
"id": "attributeGenericChargingCycles",
"type": "enums",
"enumStrings": {
"\u003e1500 Ladezyklen": "\u003e1500 Ladezyklen",
"Keine Ladezyklen": "Keine Ladezyklen",
"300-500 Ladezyklen": "300-500 Ladezyklen",
"500-800 Ladezyklen": "500-800 Ladezyklen",
"800-1500 Ladezyklen": "800-1500 Ladezyklen"
},
"meta": {
"label": {
"de": "Ladezyklen"
},
"description": {
"de": "Attribute describes the aprprox. number of charging cycles of an article."
}
},
"metaValues": {
"main": {
"label": {
"de": "Ladezyklen"
}
}
}
},
"attributeGourmetFoodAndDrinksDesignationsOfOriginAndProtectedDesignationOfOrigin": {
"id": "attributeGourmetFoodAndDrinksDesignationsOfOriginAndProtectedDesignationOfOrigin",
"type": "enums",
"enumStrings": {
"VSOP": "VSOP",
"Wein mit Rebsorte": "Wein mit Rebsorte",
"Strohwein/Schilfwein": "Strohwein/Schilfwein",
"VDP.Erste Lage": "VDP.Erste Lage",
"Cinquième Cru": "Cinquième Cru",
"VdIT": "VdIT",
"DO": "DO",
"Qualitätswein": "Qualitätswein",
"AOC": "AOC",
"DOC": "DOC",
"Eiswein": "Eiswein",
"QbA": "QbA",
"IGP": "IGP",
"Auslese": "Auslese",
"Deuxième Cru": "Deuxième Cru",
"Quatrième Cru": "Quatrième Cru",
"VDP.Gutswein": "VDP.Gutswein",
"Premier Grand Cru Classé (B)": "Premier Grand Cru Classé (B)",
"VDP.Grosses Gewächs": "VDP.Grosses Gewächs",
"AOP": "AOP",
"Troisième Cru": "Troisième Cru",
"Wine of Origin": "Wine of Origin",
"Deuxième Cru Classé": "Deuxième Cru Classé",
"Vin de France": "Vin de France",
"IGT": "IGT",
"DOCa": "DOCa",
"Grand Cru": "Grand Cru",
"AOP Cru": "AOP Cru",
"Kabinett": "Kabinett",
"Cru Bourgeois": "Cru Bourgeois",
"Ausbruch": "Ausbruch",
"VSQ": "VSQ",
"Vino da Tavola": "Vino da Tavola",
"Trockenbeerenauslese": "Trockenbeerenauslese",
"Gutswein": "Gutswein",
"Premier Cru Supérieur": "Premier Cru Supérieur",
"DOP": "DOP",
"Premier Grand Cru Classé (A)": "Premier Grand Cru Classé (A)",
"Premier Cru Classé": "Premier Cru Classé",
"Beerenauslese": "Beerenauslese",
"VDP.Grosse Lage": "VDP.Grosse Lage",
"VDP.Erstes Gewächs": "VDP.Erstes Gewächs",
"DOCG": "DOCG",
"AOP Régional": "AOP Régional",
"VDP.Ortswein": "VDP.Ortswein",
"AOP Communal": "AOP Communal",
"Premier Cru": "Premier Cru",
"DAC": "DAC",
"Hochgewächs": "Hochgewächs",
"Spätlese": "Spätlese",
"Grand Cru Classé": "Grand Cru Classé"
},
"meta": {
"label": {
"de": "Prädikate und geschützte Herkunftsbezeichnung"
},
"description": {
"de": "tbd"
}
}
},
"attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit": {
"id": "attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit",
"type": "enums",
"enumStrings": {
"CradleToCradleCertified": "CradleToCradleCertified",
"BlauerEngel": "BlauerEngel",
"ProgrammeForTheEndorsementOfForestCertification": "ProgrammeForTheEndorsementOfForestCertification",
"BluesignProduct": "BluesignProduct",
"PflanzlichGegerbtesLeder": "PflanzlichGegerbtesLeder",
"Natrue": "Natrue",
"CottonMadeInAfrica": "CottonMadeInAfrica",
"NordicEcolabel": "NordicEcolabel",
"ResponsibleDownStandard": "ResponsibleDownStandard",
"WorldFairTradeOrganization": "WorldFairTradeOrganization",
"NaturtextilIvnZertifiziertBest": "NaturtextilIvnZertifiziertBest",
"Standard100ByOekoTex": "Standard100ByOekoTex",
"LenzingEcovero": "LenzingEcovero",
"EcocertCosmosOrganic": "EcocertCosmosOrganic",
"FairtradeTextileProduction": "FairtradeTextileProduction",
"OrganicContentStandard100": "OrganicContentStandard100",
"TheGoodCashmereStandardByAbTf": "TheGoodCashmereStandardByAbTf",
"GlobalOrganicTextileStandard": "GlobalOrganicTextileStandard",
"BdihCosmosNatural": "BdihCosmosNatural",
"FairWearFoundation": "FairWearFoundation",
"FairtradeCotton": "FairtradeCotton",
"GlobalRecycledStandard": "GlobalRecycledStandard",
"ForestStewardshipCouncil": "ForestStewardshipCouncil",
"BetterCottonInitiative": "BetterCottonInitiative",
"EcocertCosmosNatural": "EcocertCosmosNatural",
"Fairtrade": "Fairtrade",
"GruenerKnopf": "GruenerKnopf",
"RecycledClaimStandard100": "RecycledClaimStandard100",
"RecycledClaimStandardBlended": "RecycledClaimStandardBlended",
"OrganicContentStandardBlended": "OrganicContentStandardBlended",
"EuEcolabel": "EuEcolabel",
"BioReSustainableCotton": "BioReSustainableCotton",
"ResponsibleWoolStandard": "ResponsibleWoolStandard",
"MadeInGreenByOekoTex": "MadeInGreenByOekoTex",
"NaturlandFuerTextilien": "NaturlandFuerTextilien",
"BdihCosmosOrganic": "BdihCosmosOrganic",
"ContentClaimStandard": "ContentClaimStandard",
"CertifiedSustainableEconomics": "CertifiedSustainableEconomics",
"BioReSustainableTextiles": "BioReSustainableTextiles",
"EcoInstitut": "EcoInstitut",
"NaturlederIvnZertifiziert": "NaturlederIvnZertifiziert",
"Downpass": "Downpass",
"Repreve": "Repreve"
},
"meta": {
"label": {
"de": "Siegellogo 3"
},
"description": {
"de": "Convert from attributeGenericSustainability.labelLogo from structured attribute to string."
}
},
"metaValues": {
"FairtradeCotton": {
"label": {
"de": "Fairtrade Cotton"
}
},
"PflanzlichGegerbtesLeder": {
"label": {
"de": "Pflanzlich gegerbtes Leder"
}
},
"ResponsibleDownStandard": {
"label": {
"de": "Responsible Down Standard"
}
},
"Downpass": {
"label": {
"de": "DOWNPASS"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/Downpass.png"
}
},
"NordicEcolabel": {
"label": {
"de": "Nordic Ecolabel"
}
},
"FairWearFoundation": {
"label": {
"de": "Fair Wear Foundation"
}
},
"MadeInGreenByOekoTex": {
"label": {
"de": "MADE IN GREEN by OEKO-TEX®"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/MadeInGreenByOekoTex.png"
}
},
"EcoInstitut": {
"label": {
"de": "eco-INSTITUT"
}
},
"GlobalRecycledStandard": {
"label": {
"de": "Global Recycled Standard"
}
},
"BdihCosmosOrganic": {
"label": {
"de": "BDIH / COSMOS Organic"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/BdihCosmosOrganic.png"
}
},
"ForestStewardshipCouncil": {
"label": {
"de": "Forest Stewardship Council®"
}
},
"Standard100ByOekoTex": {
"label": {
"de": "STANDARD 100 by OEKO-TEX®"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/Standard100ByOekoTex.png"
}
},
"OrganicContentStandard100": {
"label": {
"de": "Organic Content Standard 100"
}
},
"WorldFairTradeOrganization": {
"label": {
"de": "World Fair Trade Organization"
}
},
"EcocertCosmosNatural": {
"label": {
"de": "Ecocert / COSMOS Natural"
}
},
"Fairtrade": {
"label": {
"de": "Fairtrade"
}
},
"FairtradeTextileProduction": {
"label": {
"de": "Fairtrade Textile Production"
}
},
"ProgrammeForTheEndorsementOfForestCertification": {
"label": {
"de": "Programme for the Endorsement of Forest Certification"
}
},
"NaturlederIvnZertifiziert": {
"label": {
"de": "Naturleder IVN zertifiziert"
}
},
"ContentClaimStandard": {
"label": {
"de": "Content Claim Standard"
}
},
"BluesignProduct": {
"label": {
"de": "bluesign® PRODUCT"
}
},
"LenzingEcovero": {
"label": {
"de": "LENZING ECOVERO"
}
},
"TheGoodCashmereStandardByAbTf": {
"label": {
"de": "The Good Cashmere Standard® by AbTF"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/TheGoodCashmereStandardByAbTf.png"
}
},
"main": {
"label": {
"de": "Siegellogo 3"
}
},
"CradleToCradleCertified": {
"label": {
"de": "Cradle to Cradle Certified®"
}
},
"EcocertCosmosOrganic": {
"label": {
"de": "Ecocert / COSMOS Organic"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/EcocertCosmosOrganic.png"
}
},
"BioReSustainableCotton": {
"label": {
"de": "bioRe® Sustainable Cotton"
}
},
"Repreve": {
"label": {
"de": "REPREVE®"
}
},
"BdihCosmosNatural": {
"label": {
"de": "BDIH / COSMOS Natural"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/BdihCosmosNatural.png"
}
},
"NaturlandFuerTextilien": {
"label": {
"de": "Naturland für Textilien"
}
},
"CottonMadeInAfrica": {
"label": {
"de": "Cotton made in Africa"
}
},
"GlobalOrganicTextileStandard": {
"label": {
"de": "Global Organic Textile Standard"
}
},
"NaturtextilIvnZertifiziertBest": {
"label": {
"de": "Naturtextil IVN zertifiziert BEST"
}
},
"GruenerKnopf": {
"label": {
"de": "Grüner Knopf"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/GruenerKnopf.png"
}
},
"OrganicContentStandardBlended": {
"label": {
"de": "Organic Content Standard Blended"
}
},
"RecycledClaimStandard100": {
"label": {
"de": "Recycled Claim Standard 100"
}
},
"CertifiedSustainableEconomics": {
"label": {
"de": "Certified Sustainable Economics"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/CertifiedSustainableEconomics.png"
}
},
"Natrue": {
"label": {
"de": "NATRUE"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/Natrue.png"
}
},
"ResponsibleWoolStandard": {
"label": {
"de": "Responsible Wool Standard"
}
},
"EuEcolabel": {
"label": {
"de": "EU Ecolabel"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/EuEcolabel.png"
}
},
"BlauerEngel": {
"label": {
"de": "Blauer Engel"
}
},
"RecycledClaimStandardBlended         ": {
"label": {
"de": "Recycled Claim Standard Blended"
}
},
"BetterCottonInitiative": {
"label": {
"de": "Better Cotton Initiative"
},
"custom": {
"swatch": "https://436952545889-online-sales-content.s3.eu-central-1.amazonaws.com/decorations/attributeYflattenedAttributeGenericSustainabilityLabel3LogoKeySplit/BetterCottonInitiative.png"
}
},
"BioReSustainableTextiles": {
"label": {
"de": "bioRe® Sustainable Textiles"
}
}
}
},
"attributeBeautyBristlesType": {
"id": "attributeBeautyBristlesType",
"type": "enums",
"enumStrings": {
"Naturhaar": "Naturhaar",
"Holznoppen": "Holznoppen",
"Kunststoff": "Kunststoff",
"Metallnoppen": "Metallnoppen"
},
"meta": {
"label": {
"de": "Borsten-Art"
},
"description": {
"de": "this describes the type of bristles (e.g. plastic)"
}
}
},
"attributeHealthAndPersonalCareSextoyType": {
"id": "attributeHealthAndPersonalCareSextoyType",
"type": "enums",
"enumStrings": {
"Dildos": "Dildos",
"Männertoys": "Männertoys",
"Partnertoys": "Partnertoys",
"Bondage": "Bondage",
"Penishüllen und Penis Sleeves": "Penishüllen und Penis Sleeves",
"Sextoy-Zubehör": "Sextoy-Zubehör",
"Analtoys": "Analtoys",
"Vibratoren": "Vibratoren",
"Hodenringe": "Hodenringe",
"Liebeskugeln": "Liebeskugeln",
"Penisringe": "Penisringe",
"Sets": "Sets",
"Masturbatoren": "Masturbatoren",
"Macht \u0026 Hingabe": "Macht \u0026 Hingabe",
"Elektrosex": "Elektrosex",
"Massagegeräte": "Massagegeräte"
},
"meta": {
"label": {
"de": "Sextoy-Art"
},
"description": {
"de": "tbd"
}
}
},
"attributeGenericGeometricShape": {
"id": "attributeGenericGeometricShape",
"type": "enums",
"enumStrings": {
"Eckig": "Eckig",
"Halbrund": "Halbrund",
"Oval": "Oval",
"Rechteckig": "Rechteckig",
"Rund": "Rund"
},
"meta": {
"label": {
"de": "Geometrische Form"
},
"description": {
"de": "Describes Geometric Shape"
}
}
}
}

132
tests/data/query.json Normal file
View File

@ -0,0 +1,132 @@
{
"Explanation": "",
"Operation": "OR",
"Elements": [
{
"Matcher": {
"Attribute": "attributeBeautyBristlesType",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": {"value": "Kunststoff"},
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "attributeBeautyBristlesType",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": {"value": "Metallnoppen"},
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "asdfasd",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": {"value": "Metallnoppen"},
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "attributeBeautyBristlesType",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": {"value": "asfd"},
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "attributeBeautyBristlesType",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": {"value": ""},
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "attributeBeautyBristlesType",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": null,
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
},
{
"Matcher": {
"Attribute": "",
"Explanation": "",
"StringIn": null,
"StringAllIn": null,
"StringEquals": null,
"StringNotEquals": null,
"IntInRange": null,
"IntFrom": null,
"IntTo": null,
"IntEquals": null,
"IntNotEquals": null,
"BoolEquals": null,
"Bitmap": null
},
"Query": null
}
]
}

48
tests/query_test.go Normal file
View File

@ -0,0 +1,48 @@
package tests
import (
_ "embed"
"encoding/json"
"fmt"
"testing"
"github.com/foomo/contentfulvalidation/constants"
"github.com/foomo/contentfulvalidation/validations"
testingx "github.com/foomo/go/testing"
"github.com/stretchr/testify/assert"
)
//go:embed data/query.json
var queryData []byte
//go:embed data/attributes.json
var attributesData []byte
func getMockAttributes() constants.Attributes {
var attributes constants.Attributes
err := json.Unmarshal(attributesData, &attributes)
if err != nil {
return constants.Attributes{}
}
return attributes
}
func getMockQuery() constants.Query {
var query constants.Query
err := json.Unmarshal(queryData, &query)
if err != nil {
return constants.Query{}
}
return query
}
func Test_Query(t *testing.T) {
testingx.Tags(t)
query := getMockQuery()
testResult := []constants.QueryError{"Query Field is empty", "Query field value is expired", "Missing field values", "Missing query condition", "Query Field is empty"}
queryErrors := validations.ValidateQuery(&query, getMockAttributes())
fmt.Println("queryErrors", queryErrors)
assert.Equal(t, testResult, queryErrors)
}