I have  parametrized test with 2 variants: NULL valueand any NOT NULL valueFrom this value is depends one assert:In case NULL it should be checked if object has field1 with value1In case NOT NULL it should be checked if object has field2 with value2As I mentioned (see xUnit Tests Patterns ) using conditional statements in assert is anti-pattern.How can I solve this problem properly?I am trying at the moment to apply Guard assertion pattern:if-assertion is splitted into 2 assertionsAt the beginning there is test parameter check (NULL/NOT NULL) with guard assertion:it('case describing conditionalParamter=NOT NULL'):    expect(conditionalParamter, 'to be a', 'string') // Guard assertion which can FAIL test. Is it OK? Can I simply **SKIP** assertion WITHOUT test failing     expect(myStub.args, 'to satisfy', [[ nonConditionalParamter,  ExpressionWhichUsesNonNullConditionalParamterValue ]])it('case describing conditionalParamter= NULL')    expect(conditionalParamter, 'to be falsy') // Guard assertion. The same issue    expect(myStub.args, 'to satisfy', [[ nonConditionalParamter,  ExpressionForNullConditionalParamterValue ]])But in this case we have 2 failed assertions. Is it appropriate solution?Is there better ways to solve problem?
Dealing with conditional verification logic using guard assertion
javascript;unit testing;conditions;assertions