Files
numscript/internal/interpreter/testdata/numscript-cookbook/experimental/mixed-source-prefer-single-source.num.specs.json
Alessandro ScandoneandGitHub 3a4eb3803f feat: improve testing tool (#93)
* breaking: change assertion name

* feat: add errMissingFunds assertion

* breaking: renamed assertion

* breaking: renamed assertions

* feat: added expect.endBalances.include assertion

* feat: better test output

* fix

* feat: added focus and skip

* improve UI for focused/skipped tests

* improve test ui
2025-10-02 16:29:35 +02: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
}
]
}