-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Now that we've refactored the gallery sorting code to compute a sort index for every promise and sort by that single number, we could make the tests simpler by dropping the need for pairwise comparisons.
Instead just define a big list of different kinds of promises, listed in the order they ought to be in in a user's gallery. Then just compute the sort index for each promise and check that those numbers are sorted in ascending order.
Relevant types of promises, listed in the order they should sort in:
tiniandtdueandtfinall null (or undefined?)tinia week ago andtdueandtfinboth nulltinia day ago andtdueandtfinboth nulltiniis anything,tdueis today,tfinis null [scheldist 0]tiniis anything,tdueis 2 days ago,tfinis null [scheldist 1]tiniis anything,tdueis 2 days from now,tfinis null [scheldist 2]tiniis anything,tdueis 4 days ago,tfinis null [scheldist 3]tiniis anything,tdueis 4 days from now,tfinis null [scheldist 4]tiniis anything,tdueis 12 days ago,tfinis null [scheldist 5]tiniis anything,tdueis 24 days ago,tfinis null [scheldist 6]tiniis anything,tdueis 7 days from now,tfinis null [scheldist 7]tiniis anything,tdueis anything,tfinis yesterdaytiniis anything,tdueis anything,tfinis a week ago
So number 1 is a promise that's messed up and should sort to the very top, next are numbers 2-3 which sort by increasing creation date because they have no due dates, after that are numbers 4-11 which are incomplete promises sorted by urgency (Schelling distance), and finally numbers 12-13 are completed promises sorted by decreasing completion date.
For the "is anything" values it shouldn't matter to the sorting how those are filled in so just pick random dates and make some of them are null to ensure that doesn't break anything either.