SPB Git

Repository Public

db_test.go 595 B 26 lines go

1package db_test23import (4	"context"5	"testing"6	"time"78	"clustr.spboucher.ai/mcc/internal/testdb"9)1011func TestTimestampsAreReadAsUTC(t *testing.T) {12	pool, _ := testdb.New(t)13	var ts time.Time14	if err := pool.QueryRow(context.Background(), `select now()`).Scan(&ts); err != nil {15		t.Fatal(err)16	}17	if ts.Location() != time.UTC {18		t.Fatalf("timestamptz scanned in %v, want UTC", ts.Location())19	}20	var arr []time.Time21	pool.QueryRow(context.Background(), `select array[now()]`).Scan(&arr)22	if len(arr) != 1 || arr[0].Location() != time.UTC {23		t.Fatalf("timestamptz[] not UTC: %v", arr)24	}25}26
Files main
Menu

Theme