Unit tests for filter and forEach