added tests with mock function