Tests: refactor view tests and add more cases.