binhonglee/GlobeTrotte

View on GitHub
src/turbine/database/db_test.go

Summary

Maintainability
A
0 mins
Test Coverage
package database

import (
    "context"
    "fmt"
    "testing"
)

func TestInit(t *testing.T) {
    checkTable := `
        SELECT EXISTS(
            SELECT 1
            FROM %s
        );`

    for _, element := range tableNames {
        c := getConn()
        if _, err := c.Exec(
            context.Background(),
            fmt.Sprintf(checkTable, element),
        ); err != nil {
            t.Log(err)
            t.Errorf("initializeDB(), " + element + " was not initialized.")
        }
    }
}