adds tests for optional() method