fuzzyworld

template / commit

Adding more tests.

a4642553b09c72c8a9b7660df43d2357adb9c5cd · Pavel Safronov · 2022-10-06 10:10:59 -0700 · parents 1f7f34dc287b

Adding more tests.
 .vscode/settings.json |  3 +++
 config_test.go        | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..bd1c779
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+    "cSpell.words": ["stretchr"]
+}
diff --git a/config_test.go b/config_test.go
index 9b9a208..eca3067 100644
--- a/config_test.go
+++ b/config_test.go
@@ -67,6 +67,18 @@ func TestSaveLoadConfig(t *testing.T) {
 	assert.Equal(t, stat1.ModTime(), stat2.ModTime(), "Expected config file to not be modified, but it was")
 }
 
+func TestGetOrCreateConfig(t *testing.T) {
+	testFailure := func(configPath string) {
+		_, err := getOrCreateConfig(configPath)
+		if err == nil {
+			t.Errorf("Expected to fail to get or create config, but succeeded")
+		}
+	}
+
+	testFailure("~~~")
+	testFailure("invalid/path/invalid-config.yaml")
+}
+
 func TestValidateDefaultConfig(t *testing.T) {
 	config := defaultConfig()
 	err := validateConfig(config)