diff --git a/.gitignore b/.gitignore
index 419d0b3ace9c7c701695d40949fa3bf600496754..b2e89b4741ff6bd73660ed9046a36795f60decd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ dist
 *.egg-info
 .pytest_cache
 *.txt
+*.json
 test.py
diff --git a/test/sample_dns_cache_update.txt b/test/sample_dns_cache_update.txt
new file mode 100644
index 0000000000000000000000000000000000000000..5ba376cbd6788360041ffb88afe01e2d2dc90ac4
--- /dev/null
+++ b/test/sample_dns_cache_update.txt
@@ -0,0 +1,8 @@
+; unbound cache dump
+START_RRSET_CACHE
+test.com.   300    IN    A    93.184.216.34
+; CNAME records
+test1.local. 300 IN   A   192.168.1.100
+test.local.  300 IN   CNAME  test1.local.
+END_RRSET_CACHE
+EOF
diff --git a/test/test_sample_file.py b/test/test_sample_file.py
index 5b3d727a5cfdc4d03405a3cdf6a513bc47e66c66..c281c784bea7fa4129ecc1eebfaeb8eef14b54f5 100644
--- a/test/test_sample_file.py
+++ b/test/test_sample_file.py
@@ -9,6 +9,7 @@ from dns_unbound_cache_reader import DnsTableKeys
 self_path = os.path.abspath(__file__)
 self_dir = os.path.dirname(self_path)
 sample_cache_file = os.path.join(self_dir, "sample_dns_cache.txt")
+sample_cache_file_update = os.path.join(self_dir, "sample_dns_cache_update.txt")
 
 
 ### TEST FUNCTIONS ###
@@ -35,3 +36,18 @@ def test_read_sample_cache_file() -> None:
     assert dns_table_alias["example1.local"] == "example.local"
     assert dns_table_alias["server1.example.com"] == "_tcp_.matter.example.com"
     assert dns_table_alias["server2.example.com"] == "_tcp_.matter.example.com"
+
+
+def test_update_dns_table() -> None:
+    """
+    Test updating an existing DNS table.
+    """
+    dns_table = dns_reader.read_dns_cache(file=sample_cache_file)
+    dns_table = dns_reader.update_dns_table(dns_table, file=sample_cache_file_update)
+
+    dns_table_ip = dns_table[DnsTableKeys.IP.name]
+    assert dns_table_ip["93.184.216.34"] == "test.com"
+    assert dns_table_ip["192.168.1.100"] == "test.local"
+    
+    dns_table_alias = dns_table[DnsTableKeys.ALIAS.name]
+    assert dns_table_alias["test1.local"] == "test.local"
\ No newline at end of file