Functional Weave
Code in Python

property.holding-deposit-cap@1.0.1

vectors.json

2,150 bytes · view raw

[
 {
  "name": "£1,000 a month: £230.76, rounded down from £230.769",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "monthly"
  ],
  "expect": {
   "minor": 23076,
   "currency": "GBP"
  }
 },
 {
  "name": "£240 a week (the guidance's example): exactly £240",
  "args": [
   {
    "minor": 24000,
    "currency": "GBP"
   },
   "weekly"
  ],
  "expect": {
   "minor": 24000,
   "currency": "GBP"
  }
 },
 {
  "name": "£1,300 a month is exactly £300 a week",
  "args": [
   {
    "minor": 130000,
    "currency": "GBP"
   },
   "monthly"
  ],
  "expect": {
   "minor": 30000,
   "currency": "GBP"
  }
 },
 {
  "name": "£26,000 a year is exactly £500 a week",
  "args": [
   {
    "minor": 2600000,
    "currency": "GBP"
   },
   "annual"
  ],
  "expect": {
   "minor": 50000,
   "currency": "GBP"
  }
 },
 {
  "name": "£25,999.99 a year rounds down to £499.99",
  "args": [
   {
    "minor": 2599999,
    "currency": "GBP"
   },
   "annual"
  ],
  "expect": {
   "minor": 49999,
   "currency": "GBP"
  }
 },
 {
  "name": "not a quarter of the monthly rent: £1,500 a month is £346.15, not £375",
  "args": [
   {
    "minor": 150000,
    "currency": "GBP"
   },
   "monthly"
  ],
  "expect": {
   "minor": 34615,
   "currency": "GBP"
  }
 },
 {
  "name": "a penny a month rounds down to nothing",
  "args": [
   {
    "minor": 1,
    "currency": "GBP"
   },
   "monthly"
  ],
  "expect": {
   "minor": 0,
   "currency": "GBP"
  }
 },
 {
  "name": "zero rent",
  "args": [
   {
    "minor": 0,
    "currency": "GBP"
   },
   "weekly"
  ],
  "expect": {
   "minor": 0,
   "currency": "GBP"
  }
 },
 {
  "name": "rent in euros is refused",
  "args": [
   {
    "minor": 100000,
    "currency": "EUR"
   },
   "monthly"
  ],
  "expectError": "rent must be in GBP"
 },
 {
  "name": "negative rent is refused",
  "args": [
   {
    "minor": -100,
    "currency": "GBP"
   },
   "monthly"
  ],
  "expectError": "rent must not be negative"
 },
 {
  "name": "an unknown rent period is refused",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "quarterly"
  ],
  "expectError": "unknown rent period"
 }
]