refactored test with mocks to prevent it from failing in CI