Fix basket sort order and add unit test.