Optional reviewer/approver duties leave UserID=0; writing 0 into document_records FK columns failed with SQLSTATE 23503. Align create path with docduty nullIfZero and surface ensureUser failures in logs. Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
352 B
Go
17 lines
352 B
Go
package docgov
|
|
|
|
import "testing"
|
|
|
|
func TestNullIfZero(t *testing.T) {
|
|
t.Parallel()
|
|
if got := nullIfZero(0); got != nil {
|
|
t.Fatalf("nullIfZero(0)=%v want nil", got)
|
|
}
|
|
if got := nullIfZero(-1); got != nil {
|
|
t.Fatalf("nullIfZero(-1)=%v want nil", got)
|
|
}
|
|
if got := nullIfZero(9); got != int64(9) {
|
|
t.Fatalf("nullIfZero(9)=%v want 9", got)
|
|
}
|
|
}
|