Files
numscript/internal/interpreter/testdata/numscript-cookbook/experimental/mixed-source-prefer-single-source.num.specs.json
Alessandro ScandoneandGitHub e58c2c09e8 fix: properly version json schemas (#171)
* fix: update schemas

* fix: update the schema of new specs file generator

* fix: update specs $schema field to the new one
2026-07-10 10:49:32 +02:00

98 lines
2.0 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/formancehq/numscript/main/v1.specs.schema.json",
"variables": {
"amt": "10"
},
"featureFlags": [
"experimental-oneof"
],
"testCases": [
{
"it": "sends from the first source when there is enough balance",
"balances": [
{
"account": "s1",
"asset": "USD",
"amount": 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": [
{
"account": "s1",
"asset": "USD",
"amount": 9
},
{
"account": "s2",
"asset": "USD",
"amount": 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": [
{
"account": "s1",
"asset": "USD",
"amount": 6
},
{
"account": "s2",
"asset": "USD",
"amount": 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": [
{
"account": "s1",
"asset": "USD",
"amount": 5
},
{
"account": "s2",
"asset": "USD",
"amount": 4
}
],
"expect.error.missingFunds": true
}
]
}