package repositories_test import ( "database/sql" "go-cook/api/repositories" "log" "testing" _ "github.com/glebarez/go-sqlite" ) func TestCanCreateNewUser(t *testing.T) { db, err := sql.Open("sqlite", "../../gocook.db") if err != nil { log.Println("unable to open connection") t.FailNow() } defer db.Close() repo := repositories.NewUserRepository(db) updated, err := repo.NewUser("testing", "NotSecure") if err != nil { log.Println(err) t.FailNow() } log.Println(updated) } func TestCanFindUserInTable(t *testing.T) { db, err := sql.Open("sqlite", "../../gocook.db") if err != nil { log.Println("unable to open connection") t.FailNow() } defer db.Close() repo := repositories.NewUserRepository(db) repo.GetByName("testing") }