package main

import (
	"strings"
	"testing"
)

func TestRunRequiresMySQLDSN(t *testing.T) {
	t.Setenv("MYSQL_DSN", "")
	if err := run(); err == nil || !strings.Contains(err.Error(), "MYSQL_DSN is required") {
		t.Fatalf("run() error=%v", err)
	}
}

func TestRunRejectsUnsafeTimeout(t *testing.T) {
	t.Setenv("MYSQL_DSN", "ignored")
	t.Setenv("RECONCILIATION_TIMEOUT_SEC", "1")
	if err := run(); err == nil || !strings.Contains(err.Error(), "between 10 and 1800") {
		t.Fatalf("run() error=%v", err)
	}
}
