I'm trying to test this function:
setToday(Map filters) {
if (filters['today'] == false) {
filters['yesterday'] = false;
filters['lastWeek'] = false;
filters['lastMonth'] = false;
filters['customRange'] = false;
filters['today'] = true;
} else
filters['today'] = false;
}
And this is the test:
test("", (){
Map<String, bool> filters = {
"today" : false,
"yesterday" : false,
"lastWeek" : false,
"lastMonth" : false,
"customRange" : false,
};
expect(_kpiFilterViewController.setToday(filters), filters["today"] == true);
});
But the result is :
Expected: <true>
Actual: <null>
What is my mistake?