micrach/db/db_test.go
Yanislav Igonin db8a46cdf1
build: modernize Wave 1 baseline (#16)
* chore: add agents md

* docs: expand repository and setup guides

* docs: plan project modernization

* docs: add Wave 1 implementation plan

* test: characterize legacy behavior

* build: update Go and Fiber v2

* fix(gateway): preserve duplicate auth behavior

* refactor(db): migrate to pgx v5

* refactor: replace deprecated I/O APIs

* build: add local PostgreSQL compose

* build: add multi-stage image

* ci: replace legacy deployment workflow

* fix(deps): update vulnerable Go modules

* docs: document modern development workflow
2026-07-16 16:08:54 +09:00

29 lines
592 B
Go

package db
import (
"errors"
"testing"
"github.com/jackc/pgx/v5/pgconn"
)
func TestIsUndefinedTable(t *testing.T) {
tests := []struct {
name string
err error
want bool
}{
{name: "undefined table", err: &pgconn.PgError{Code: "42P01"}, want: true},
{name: "other postgres error", err: &pgconn.PgError{Code: "23505"}},
{name: "ordinary error", err: errors.New("boom")},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isUndefinedTable(tt.err); got != tt.want {
t.Fatalf("isUndefinedTable() = %v, want %v", got, tt.want)
}
})
}
}