mirror of
https://github.com/hanzoai/numscript.git
synced 2026-10-30 18:26:57 +00:00
* feat: feature flag syntax * feat: change syntax * feat: reject invalid features * feat: add static check of unknown features * feat: more defensive args handling * fix: fix typo
57 lines
1.3 KiB
JSON
57 lines
1.3 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json",
|
|
"featureFlags": [
|
|
"experimental-overdraft-function",
|
|
"experimental-mid-script-function-call",
|
|
"experimental-oneof"
|
|
],
|
|
"variables": {
|
|
"amt": "100"
|
|
},
|
|
"testCases": [
|
|
{
|
|
"it": "should be a noop when all balances are >= 0",
|
|
"balances": { "alice": { "EUR": 100 }, "bob": { "EUR": 200 } },
|
|
"expect.postings": []
|
|
},
|
|
{
|
|
"it": "should prioritize alice when both have missing funds",
|
|
"balances": {
|
|
"alice": { "EUR": -120 },
|
|
"bob": { "EUR": -120 }
|
|
},
|
|
"expect.postings": [
|
|
{
|
|
"source": "world",
|
|
"destination": "alice",
|
|
"amount": 100,
|
|
"asset": "EUR"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"it": "doesn't send funds to alice if there aren't enough funds for the account to be topped-up",
|
|
"balances": {
|
|
"alice": { "EUR": -80 },
|
|
"bob": { "EUR": -120 }
|
|
},
|
|
"expect.postings": [
|
|
{
|
|
"source": "world",
|
|
"destination": "bob",
|
|
"amount": 100,
|
|
"asset": "EUR"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"it": "funds are kept if there are spare funds",
|
|
"balances": {
|
|
"alice": { "EUR": -10 },
|
|
"bob": { "EUR": -20 }
|
|
},
|
|
"expect.postings": []
|
|
}
|
|
]
|
|
}
|