refactorring test for index