Test an error to have a specific name. @param expected - Expected name of the Error.
(expected: string)
| 14 | @param expected - Expected name of the Error. |
| 15 | */ |
| 16 | name(expected: string): this { |
| 17 | return this.addValidator({ |
| 18 | message: (error, label) => `Expected ${label} to have name \`${expected}\`, got \`${error.name}\``, |
| 19 | validator: error => error.name === expected, |
| 20 | }); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | Test an error to have a specific message. |