when formatted
- <moment> [when] formatted <assertion?>
Format a moment instance using the default ISO8601 format, then delegate the formatted value to another assertion.
expect(moment('2015-11-02'), 'when formatted to be', '2015-11-02T00:00:00+01:00');
When the assertion fails you'll get this output:
expect(moment('2015-11-02'), 'when formatted to be', '2015');
expected moment('2015-11-02T00:00:00.000+01:00') when formatted to be '2015'
2015-11-02T00:00:00+01:00
2015