Add test for 'when'