package commerce

import "testing"

func TestPresent(t *testing.T) {
	if present("") {
		t.Fatal("expected empty string to be absent")
	}
	if !present("x") {
		t.Fatal("expected non-empty string to be present")
	}
	if !present(false) {
		t.Fatal("expected boolean value to be present")
	}
}

func TestTruthy(t *testing.T) {
	for _, value := range []any{true, "true", "1", "required", 1, int64(1), float64(1)} {
		if !truthy(value) {
			t.Fatalf("expected truthy value: %#v", value)
		}
	}
}
