diff --git a/tests/unit/mapper/destination_response_good_01.json b/tests/unit/mapper/destination_response_good_01.json index d5db501..ca42ed4 100644 --- a/tests/unit/mapper/destination_response_good_01.json +++ b/tests/unit/mapper/destination_response_good_01.json @@ -4,7 +4,7 @@ "id": "2008d4d2-49fd-48e4-a305-796b75953edd", "author": "Japanese Proverb", "quote": "Discipline will sooner or later defeat intelligence", - "quality": 5, + "quality": "AWESOME", "category": "Discipline", "sentiment": "Positive", "allTypes": [ @@ -26,7 +26,7 @@ "id": "ab93c944-8c77-4e79-84e4-c78cb125f1ad", "author": "Alex Hormozi", "quote": "The longer you delay the ask, the bigger the ask you can make", - "quality": 5, + "quality": "AWESOME", "category": "Success", "sentiment": "Positive", "allTypes": [ @@ -51,7 +51,7 @@ "id": "98d42874-29ad-47f8-977c-ba51857ae3ee", "author": "Benjamin Franklin", "quote": "Well done is better than well said", - "quality": 4, + "quality": "N/A", "category": "Life", "sentiment": "Positive", "allTypes": [ @@ -70,7 +70,7 @@ "id": "419364b4-0e60-425a-8548-b14020b442ea", "author": "Charles F. Kettering", "quote": "A problem well stated is a problem half solved", - "quality": 3 + "quality": "GOOD" } ] } diff --git a/tests/unit/mapper/test_mapper.py b/tests/unit/mapper/test_mapper.py index 0eb5bc9..83b4e2a 100644 --- a/tests/unit/mapper/test_mapper.py +++ b/tests/unit/mapper/test_mapper.py @@ -1,6 +1,7 @@ +import os +import json import pytest from src.mapper.mapper import Mapper -from jsonpath_ng.jsonpath import JSONPath # Mocking os.path.join to avoid reading a real JSON mapper file @@ -170,3 +171,20 @@ def test_mapper_convert_payload_multiple(): ] } } + + +def test_mapper_real_complete_payload_01(): + from src.mapper.mapper import Mapper + + current_dir = os.path.dirname(os.path.abspath(__file__)) + payload_path = os.path.join(current_dir, "source_payload_good_01.json") + response_path = os.path.join(current_dir, "destination_response_good_01.json") + + with open(payload_path, "r") as payload_file: + payload = json.load(payload_file) + + with open(response_path, "r") as response_file: + expected_response = json.load(response_file) + + mapper = Mapper(payload) + assert mapper.convert_payload() == expected_response