mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
EmbedConfig.Ceiling is declared by the host as Born is: Test where the network holds no real money, "" or Live for no cap, and any other value caps at Test. Under a Test ceiling TestMode is true for every org, a record marked Live included, so it charges sandbox credentials, writes the test books and publishes the sandbox application. TestMode is the one reading of the mode: the ledger, balance, transaction, library, account and Authorize.Net paths, StripeToken and PayPal read it instead of org.Live, so the ceiling holds on each of them. Co-authored-by: Hanzo Dev <[email protected]>
24 lines
614 B
Go
24 lines
614 B
Go
package commerce
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hanzoai/commerce/models/organization"
|
|
)
|
|
|
|
// A host's declaration maps to a cap: none for "" and Live, Test for Test and
|
|
// for anything unrecognised.
|
|
func TestCeilingOf(t *testing.T) {
|
|
for in, want := range map[organization.Kind]organization.Kind{
|
|
"": organization.Live,
|
|
organization.Live: organization.Live,
|
|
organization.Test: organization.Test,
|
|
"production": organization.Test,
|
|
"sandbox": organization.Test,
|
|
} {
|
|
if got := ceilingOf(in); got != want {
|
|
t.Errorf("ceilingOf(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|