Bad tests on sortdirection

The old code tested for lower case asc and desc, but the only caller
used upper case, Then the code added a space in front of the string, but
later tested against a string without the space