[
{
"name": "charge-out value of two entries with a 10% write-down",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"charge-out",
1000,
"GBP"
],
"expect": {
"minutes": 135,
"gross": {
"minor": 41250,
"currency": "GBP"
},
"writeDown": {
"minor": 4125,
"currency": "GBP"
},
"net": {
"minor": 37125,
"currency": "GBP"
}
}
},
{
"name": "the same time at cost, no write-down",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"cost",
0,
"GBP"
],
"expect": {
"minutes": 135,
"gross": {
"minor": 12000,
"currency": "GBP"
},
"writeDown": {
"minor": 0,
"currency": "GBP"
},
"net": {
"minor": 12000,
"currency": "GBP"
}
}
},
{
"name": "rounded per entry: two 7-minute entries at 100.00 an hour are 23.34, not 23.33",
"args": [
[
{
"minutes": 7,
"costRate": {
"minor": 5000,
"currency": "GBP"
},
"chargeRate": {
"minor": 10000,
"currency": "GBP"
}
},
{
"minutes": 7,
"costRate": {
"minor": 5000,
"currency": "GBP"
},
"chargeRate": {
"minor": 10000,
"currency": "GBP"
}
}
],
"charge-out",
0,
"GBP"
],
"expect": {
"minutes": 14,
"gross": {
"minor": 2334,
"currency": "GBP"
},
"writeDown": {
"minor": 0,
"currency": "GBP"
},
"net": {
"minor": 2334,
"currency": "GBP"
}
}
},
{
"name": "a write-down landing on half a penny rounds up",
"args": [
[
{
"minutes": 60,
"costRate": {
"minor": 12345,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
}
],
"cost",
5000,
"GBP"
],
"expect": {
"minutes": 60,
"gross": {
"minor": 12345,
"currency": "GBP"
},
"writeDown": {
"minor": 6173,
"currency": "GBP"
},
"net": {
"minor": 6172,
"currency": "GBP"
}
}
},
{
"name": "a 100% write-down leaves nothing",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"charge-out",
10000,
"GBP"
],
"expect": {
"minutes": 135,
"gross": {
"minor": 41250,
"currency": "GBP"
},
"writeDown": {
"minor": 41250,
"currency": "GBP"
},
"net": {
"minor": 0,
"currency": "GBP"
}
}
},
{
"name": "no unbilled time values at zero in the named currency",
"args": [
[],
"charge-out",
1500,
"EUR"
],
"expect": {
"minutes": 0,
"gross": {
"minor": 0,
"currency": "EUR"
},
"writeDown": {
"minor": 0,
"currency": "EUR"
},
"net": {
"minor": 0,
"currency": "EUR"
}
}
},
{
"name": "a zero-minute entry adds nothing",
"args": [
[
{
"minutes": 0,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 30,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
}
],
"charge-out",
0,
"GBP"
],
"expect": {
"minutes": 30,
"gross": {
"minor": 10000,
"currency": "GBP"
},
"writeDown": {
"minor": 0,
"currency": "GBP"
},
"net": {
"minor": 10000,
"currency": "GBP"
}
}
},
{
"name": "an entry at a zero cost rate (a trainee's pro bono time) is zero at cost",
"args": [
[
{
"minutes": 120,
"costRate": {
"minor": 0,
"currency": "GBP"
},
"chargeRate": {
"minor": 9000,
"currency": "GBP"
}
}
],
"cost",
0,
"GBP"
],
"expect": {
"minutes": 120,
"gross": {
"minor": 0,
"currency": "GBP"
},
"writeDown": {
"minor": 0,
"currency": "GBP"
},
"net": {
"minor": 0,
"currency": "GBP"
}
}
},
{
"name": "in US dollars, 1 minute at 99.99 an hour rounds half-up to 1.67",
"args": [
[
{
"minutes": 1,
"costRate": {
"minor": 5000,
"currency": "USD"
},
"chargeRate": {
"minor": 9999,
"currency": "USD"
}
}
],
"charge-out",
0,
"USD"
],
"expect": {
"minutes": 1,
"gross": {
"minor": 167,
"currency": "USD"
},
"writeDown": {
"minor": 0,
"currency": "USD"
},
"net": {
"minor": 167,
"currency": "USD"
}
}
},
{
"name": "a write-down over 100% is an error",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"cost",
10001,
"GBP"
],
"expectError": "writeDownBasisPoints must be between 0 and 10000"
},
{
"name": "a negative write-down is an error",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"cost",
-1,
"GBP"
],
"expectError": "writeDownBasisPoints must be between 0 and 10000"
},
{
"name": "negative minutes are an error",
"args": [
[
{
"minutes": -6,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
}
],
"cost",
0,
"GBP"
],
"expectError": "minutes must be a non-negative integer"
},
{
"name": "a rate in another currency is an error",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"cost",
0,
"EUR"
],
"expectError": "currency mismatch"
},
{
"name": "an unknown basis is an error",
"args": [
[
{
"minutes": 90,
"costRate": {
"minor": 6000,
"currency": "GBP"
},
"chargeRate": {
"minor": 20000,
"currency": "GBP"
}
},
{
"minutes": 45,
"costRate": {
"minor": 4000,
"currency": "GBP"
},
"chargeRate": {
"minor": 15000,
"currency": "GBP"
}
}
],
"market",
0,
"GBP"
],
"expectError": "unknown WIP basis"
}
]