Unit tests

- Do a unit test that attempts parsing BROKEN shcedule JSON data
This commit is contained in:
Tristan B. Velloza Kildaire 2023-06-02 16:35:26 +02:00
parent 04dc338183
commit 97508fe66c
1 changed files with 26 additions and 0 deletions

View File

@ -165,4 +165,30 @@ unittest
{
assert(false);
}
}
/**
* Test building a `Schedule` from the example JSON
* buit where the JSON is BROKEN
*/
private unittest
{
string json = `
{
"area_name": "western-cape-worscester",
"stage": 4,
"start": "2023-06-01T14:00:00+02:00",
"finsh": 2
}`;
try
{
Schedule schedule = Schedule.fromJSON(parseJSON(json));
assert(false);
}
catch(EskomCalendarException e)
{
assert(e.getError() == ErrType.INVALID_SCHEDULE_DATA);
}
}