For more information, check out the documentation of the test function.
Test Description
Each test's description is automatically generated. It uses the Gherkin syntax (given-when-then).
For isValid tests :
Given a {modddelName} {modddelKind}When instantiated with {params}Then the {modddelName} is a {validName}
For isSanitized tests :
For isInvalid tests :
Example : For this test :
The generated description is :
The maxTestInfoLength
As you can see, the description can contain {params}, {sanitizedParams} and {failure}. These can be quite long strings, which would cause the description to become too long and unreadable.
To keep the description short enough, each one of those strings' length is limited to maxTestInfoLength, beyond which they are ellipsized. This maxTestInfoLength defaults to 200 characters, but it can be modified by :
Providing it in the modddel annotation :
Providing it in the Tester's constructor. This takes priority over maxTestInfoLength set in @Modddel.
Providing it in the test method itself. This takes priority over maxTestInfoLength set in the Tester's constructor.
This "ellipsisation" can be disabled by setting maxTestInfoLength to Modddel.noMaxLength (which equals -1).
Given a {modddelName} {modddelKind}
When instantiated with {params}
Then the {modddelName} holds {sanitizedParams}
Given a {modddelName} {modddelKind}
When instantiated with {params}
Then the {modddelName} is an {invalidStepName}
# If the failure argument of `isInvalid` is null :
And has no {failure1Name}
# If the failure argument of `isInvalid` is not null :
And has a {failure1Name} that equals {failure1}
# ... (one line for each failure argument)
Given a Age SingleValueObject
When instantiated with (value: 12)
Then the Age is an InvalidAgeValue
And has a AgeLegalFailure that equals AgeLegalFailure.minor()
@Modddel(
// validationSteps: [...],
maxTestInfoLength: 50,
)
// class Name extends SingleValueObject ...
const testName = TestName(maxTestInfoLength: 20);
testName.isValid(
const NameParams('This is a very long name'),
maxTestInfoLength: 10,
);