From 619048b162abb25b33c07879ff14e24e05b48722 Mon Sep 17 00:00:00 2001 From: Georg Ledermann Date: Mon, 22 Jan 2024 11:22:11 +0100 Subject: [PATCH] Cloud: Add test to ensure data keys --- spec/lib/senec/cloud/dashboard_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/lib/senec/cloud/dashboard_spec.rb b/spec/lib/senec/cloud/dashboard_spec.rb index 53673e3..09342f3 100644 --- a/spec/lib/senec/cloud/dashboard_spec.rb +++ b/spec/lib/senec/cloud/dashboard_spec.rb @@ -73,6 +73,21 @@ it 'fetches the data' do expect(dashboard.data).to include('aktuell', 'heute') end + + it 'fetches data with keys' do + expected_keys = %w[ + stromerzeugung stromverbrauch + netzeinspeisung netzbezug + speicherbeladung speicherentnahme + speicherfuellstand + autarkie + wallbox + ] + + %w[aktuell heute].each do |key| + expect(dashboard.data[key].keys).to match_array(expected_keys) + end + end end context 'with INVALID system_id', vcr: 'cloud/fetch-dashboard-invalid-system' do