From de96851d8eb0a0b45d7bf0cee67339fea54349f0 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 12 Feb 2026 21:35:46 -0800 Subject: wip: tui updates (buggy) --- importer/importer_test.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'importer/importer_test.go') diff --git a/importer/importer_test.go b/importer/importer_test.go index 00ab822..59f06f1 100644 --- a/importer/importer_test.go +++ b/importer/importer_test.go @@ -11,7 +11,7 @@ import ( func setupTestDB(t *testing.T) { t.Helper() - config.Config.DBFile = ":memory:" + config.Config.DBFile = filepath.Join(t.TempDir(), "test.db") models.InitDB() t.Cleanup(func() { if models.DB != nil { @@ -127,3 +127,23 @@ func TestImportJSON(t *testing.T) { t.Errorf("Expected 1 feed after import, got %d", feedCount) } } + +func TestImportJSONInvalid(t *testing.T) { + setupTestDB(t) + dir := t.TempDir() + jsonFile := filepath.Join(dir, "invalid.json") + os.WriteFile(jsonFile, []byte("not json"), 0644) + + err := ImportJSON(jsonFile) + if err == nil { + t.Error("ImportJSON should error on invalid JSON") + } +} + +func TestImportJSONNonexistent(t *testing.T) { + setupTestDB(t) + err := ImportJSON("/nonexistent/file.json") + if err == nil { + t.Error("ImportJSON should error on nonexistent file") + } +} -- cgit v1.2.3