mirror of
https://github.com/hanzo-fi/numscript.git
synced 2026-10-30 20:54:52 +00:00
reworked balances representation (both internal and external) so that it handles colors as an ad-hoc field instead of relying of string convetions
88 lines
1.9 KiB
JSON
88 lines
1.9 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/formancehq/numscript/29a351f9aa5ae03d72b85f55981e52dd57e81c07/specs.schema.json",
|
|
"variables": {
|
|
"amt": "100"
|
|
},
|
|
"featureFlags": [
|
|
"experimental-overdraft-function"
|
|
],
|
|
"testCases": [
|
|
{
|
|
"balances": [
|
|
{
|
|
"account": "invoice:001",
|
|
"asset": "USD/2",
|
|
"amount": -999
|
|
}
|
|
],
|
|
"it": "only sends to the first one if there's not enough funds to top-up its balance",
|
|
"expect.postings": [
|
|
{
|
|
"source": "world",
|
|
"destination": "invoice:001",
|
|
"amount": 100,
|
|
"asset": "USD/2"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"balances": [
|
|
{
|
|
"account": "invoice:001",
|
|
"asset": "USD/2",
|
|
"amount": -99
|
|
},
|
|
{
|
|
"account": "invoice:002",
|
|
"asset": "USD/2",
|
|
"amount": -999
|
|
}
|
|
],
|
|
"it": "it sends to the second source after topping-up the first one",
|
|
"expect.postings": [
|
|
{
|
|
"source": "world",
|
|
"destination": "invoice:001",
|
|
"amount": 99,
|
|
"asset": "USD/2"
|
|
},
|
|
{
|
|
"source": "world",
|
|
"destination": "invoice:002",
|
|
"amount": 1,
|
|
"asset": "USD/2"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"balances": [
|
|
{
|
|
"account": "invoice:001",
|
|
"asset": "USD/2",
|
|
"amount": -2
|
|
},
|
|
{
|
|
"account": "invoice:002",
|
|
"asset": "USD/2",
|
|
"amount": -3
|
|
}
|
|
],
|
|
"it": "it keeps the spare amount",
|
|
"expect.postings": [
|
|
{
|
|
"source": "world",
|
|
"destination": "invoice:001",
|
|
"amount": 2,
|
|
"asset": "USD/2"
|
|
},
|
|
{
|
|
"source": "world",
|
|
"destination": "invoice:002",
|
|
"amount": 3,
|
|
"asset": "USD/2"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|