Skip to content

Commit

Permalink
Fixing linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino committed Feb 23, 2024
1 parent 8febd52 commit 6ce1ec1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion modules/surrealdb/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ExampleRunContainer() {

state, err := surrealdbContainer.State(ctx)
if err != nil {
log.Fatal(err)
log.Fatal(err) // nolint:gocritic
}

fmt.Println(state.Running)
Expand Down
40 changes: 20 additions & 20 deletions modules/surrealdb/surrealdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package surrealdb

import (
"context"
"log"
"testing"

"github.com/surrealdb/surrealdb.go"

"github.com/testcontainers/testcontainers-go"
)

Expand All @@ -28,21 +28,21 @@ func TestSurrealDBSelect(t *testing.T) {
url, err := container.URL(ctx)
// }
if err != nil {
log.Fatal(err)
t.Fatal(err)
}

db, err := surrealdb.New(url)
if err != nil {
log.Fatal(err)
t.Fatal(err)
}
defer db.Close()

if _, err := db.Signin(map[string]string{"user": "root", "pass": "root"}); err != nil {
log.Fatal(err)
t.Fatal(err)
}

if _, err := db.Use("test", "test"); err != nil {
log.Fatal(err)
t.Fatal(err)
}

if _, err := db.Create("person.tobie", map[string]any{
Expand All @@ -53,26 +53,26 @@ func TestSurrealDBSelect(t *testing.T) {
},
"marketing": true,
}); err != nil {
log.Fatal(err)
t.Fatal(err)
}

result, err := db.Select("person.tobie")
if err != nil {
log.Fatal(err)
t.Fatal(err)
}

resultData := result.([]any)[0].(map[string]interface{})
if resultData["title"] != "Founder & CEO" {
log.Fatal("title is not Founder & CEO")
t.Fatal("title is not Founder & CEO")
}
if resultData["name"].(map[string]interface{})["first"] != "Tobie" {
log.Fatal("name.first is not Tobie")
t.Fatal("name.first is not Tobie")
}
if resultData["name"].(map[string]interface{})["last"] != "Morgan Hitchcock" {
log.Fatal("name.last is not Morgan Hitchcock")
t.Fatal("name.last is not Morgan Hitchcock")
}
if resultData["marketing"] != true {
log.Fatal("marketing is not true")
t.Fatal("marketing is not true")
}
}

Expand All @@ -93,17 +93,17 @@ func TestSurrealDBNoAuth(t *testing.T) {

url, err := container.URL(ctx)
if err != nil {
log.Fatal(err)
t.Fatal(err)
}

db, err := surrealdb.New(url)
if err != nil {
log.Fatal(err)
t.Fatal(err)
}
defer db.Close()

if _, err := db.Use("test", "test"); err != nil {
log.Fatal(err)
t.Fatal(err)
}

if _, err := db.Create("person.tobie", map[string]any{
Expand All @@ -114,25 +114,25 @@ func TestSurrealDBNoAuth(t *testing.T) {
},
"marketing": true,
}); err != nil {
log.Fatal(err)
t.Fatal(err)
}

result, err := db.Select("person.tobie")
if err != nil {
log.Fatal(err)
t.Fatal(err)
}

resultData := result.([]any)[0].(map[string]interface{})
if resultData["title"] != "Founder & CEO" {
log.Fatal("title is not Founder & CEO")
t.Fatal("title is not Founder & CEO")
}
if resultData["name"].(map[string]interface{})["first"] != "Tobie" {
log.Fatal("name.first is not Tobie")
t.Fatal("name.first is not Tobie")
}
if resultData["name"].(map[string]interface{})["last"] != "Morgan Hitchcock" {
log.Fatal("name.last is not Morgan Hitchcock")
t.Fatal("name.last is not Morgan Hitchcock")
}
if resultData["marketing"] != true {
log.Fatal("marketing is not true")
t.Fatal("marketing is not true")
}
}

0 comments on commit 6ce1ec1

Please sign in to comment.