Files
numscript/internal/interpreter/testdata/numscript-cookbook/experimental/mixed-source-prefer-single-source.num.specs.json
Alessandro ScandoneandGitHub 5dfc34cd3c feat: feature flag syntax (#120)
* 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
2026-03-04 13:32:35 +00:00

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
}
]
}