aboutsummaryrefslogtreecommitdiffstats
path: root/importer/importer_test.go
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-12 21:35:46 -0800
commitde96851d8eb0a0b45d7bf0cee67339fea54349f0 (patch)
treed9ca55835743e2254732ea68a674e7007f3554eb /importer/importer_test.go
parent8a8f516ebd1115eed6256cd1b60be6393fd42c26 (diff)
downloadneko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.gz
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.tar.bz2
neko-de96851d8eb0a0b45d7bf0cee67339fea54349f0.zip
wip: tui updates (buggy)
Diffstat (limited to 'importer/importer_test.go')
-rw-r--r--importer/importer_test.go22
1 files changed, 21 insertions, 1 deletions
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")
+ }
+}