mirror of
https://github.com/hanzo-fi/numscript.git
synced 2026-10-30 20:54:52 +00:00
* fix: update schemas * fix: update the schema of new specs file generator * fix: update specs $schema field to the new one
98 lines
2.0 KiB
JSON
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
|
|
}
|
|
]
|
|
}
|