Skip to content

Commit

Permalink
feat(fronius): adding schedule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atbore-phx committed Mar 4, 2024
1 parent 5ca3240 commit 050942b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/fronius/fronius_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,25 @@ func TestOpenCloseModbusClient(t *testing.T) {
assert.NoError(err, "OpenModbusClient returned an error")

}

func TestSetChargePower(t *testing.T) {
assert := assert.New(t)

result := fronius.SetChargePower(100.0, 50.0, 50.0)
assert.Equal(int16(50), result, "SetChargePower returned wrong value")

result = fronius.SetChargePower(100.0, 80.0, 50.0)
assert.Equal(int16(50), result, "SetChargePower returned wrong value")
}

func TestCheckTimeRange(t *testing.T) {
assert := assert.New(t)

isInRange, err := fronius.CheckTimeRange("00:00", "23:59")
assert.NoError(err, "CheckTimeRange returned an error")
assert.True(isInRange, "CheckTimeRange returned false when it should return true")

isInRange, err = fronius.CheckTimeRange("23:59", "00:00")
assert.NoError(err, "CheckTimeRange returned an error")
assert.False(isInRange, "CheckTimeRange returned true when it should return false")
}

0 comments on commit 050942b

Please sign in to comment.