Use expect instead of lambda in tests