From 7bb6f5feefae23ca719db98811cd19b8fa153892 Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Tue, 2 Oct 2018 15:29:00 -0600 Subject: [PATCH] Add tests --- config_test.go | 6 ++++-- test_config.yml | 12 ------------ 2 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 test_config.yml diff --git a/config_test.go b/config_test.go index d0b0a25..90ad73f 100644 --- a/config_test.go +++ b/config_test.go @@ -23,10 +23,12 @@ func Test_LoadConfig(t *testing.T) { testConfig := Config{Sensors: []Sensor{testSensor}} - loadedConfig, err := LoadConfig("test_config.yml") + loadedConfig, err := LoadConfig("tests/test_config.yml") assert.Equal(t, nil, err) assert.Equal(t, &testConfig, loadedConfig) - _, err = LoadConfig("thisfiledoesnotexist") + _, err = LoadConfig("tests/duplicate_id.yml") + assert.NotEqual(t, nil, err) + _, err = LoadConfig("tests/duplicate_alias.yml") assert.NotEqual(t, nil, err) } diff --git a/test_config.yml b/test_config.yml deleted file mode 100644 index f2ac9d2..0000000 --- a/test_config.yml +++ /dev/null @@ -1,12 +0,0 @@ -sensors: -- id: 28-000008083108 - alias: fermenter - hightemp: 8 - lowtemp: 4 - heatgpio: 5 - heatinvert: true - heatminutes: 5 - coolgpio: 17 - coolinvert: false - coolminutes: 10 - verbose: true