Refactor block getCurrentPageType with full test coverage