Make tests reliable

Turned out that content of directories is returned in random order. Making sure
not to depend on particular order.