Test refactoring with factories

Using factories for most of the tests
Also converting everything I can find to expect syntax.

And fixing some indentation + whitespaces