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
82 lines
1.6 KiB
JSON
82 lines
1.6 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/specs.schema.json",
|
|
"variables": {
|
|
"amt": "10"
|
|
},
|
|
"featureFlags": ["experimental-oneof"],
|
|
"testCases": [
|
|
{
|
|
"it": "sends from the first source when there is enough balance",
|
|
"balances": {
|
|
"s1": {
|
|
"USD": 999
|
|
}
|
|
},
|
|
"expect.postings": [
|
|
{
|
|
"source": "s1",
|
|
"destination": "dest",
|
|
"amount": 10,
|
|
"asset": "USD"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"it": "sends from the second one when it has enough balance but the first one doesn't",
|
|
"balances": {
|
|
"s1": {
|
|
"USD": 9
|
|
},
|
|
"s2": {
|
|
"USD": 999
|
|
}
|
|
},
|
|
"expect.postings": [
|
|
{
|
|
"source": "s2",
|
|
"destination": "dest",
|
|
"amount": 10,
|
|
"asset": "USD"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"it": "sends partially from both when none of them has enough balance on its own",
|
|
"balances": {
|
|
"s1": {
|
|
"USD": 6
|
|
},
|
|
"s2": {
|
|
"USD": 9
|
|
}
|
|
},
|
|
"expect.postings": [
|
|
{
|
|
"source": "s1",
|
|
"destination": "dest",
|
|
"amount": 6,
|
|
"asset": "USD"
|
|
},
|
|
{
|
|
"source": "s2",
|
|
"destination": "dest",
|
|
"amount": 4,
|
|
"asset": "USD"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"it": "fails if there aren't enough funds between all sources",
|
|
"balances": {
|
|
"s1": {
|
|
"USD": 5
|
|
},
|
|
"s2": {
|
|
"USD": 4
|
|
}
|
|
},
|
|
"expect.error.missingFunds": true
|
|
}
|
|
]
|
|
}
|