sl-ember-components
sl-ember-components copied to clipboard
"Integration | Component | sl date time: Date values applied correctly" test failing in CI
not ok 103 PhantomJS 1.9 - Integration | Component | sl date time: Date values applied correctly
---
actual: >
2015-11-26
expected: >
2015-11-27
message: >
Default date string matches default date pattern
Log: |
...
I re-ran the build on CI several times and it kept failing. When I ran it again the next day (27 Feb 2016) it was passing again. Perhaps our logic approach is flawed?
This is when the content of the test case was:
test( 'Date values applied correctly', function( assert ) {
const pastDateISO = window.moment().subtract( 3, 'months' ).toISOString();
this.set( 'value', pastDateISO );
this.render( hbs`
{{sl-date-time
format="date"
timezone="America/Chicago"
value=value
}}
` );
const pastRendered = this.$( '>:first-child' ).text().trim();
const pastDate = window.moment().subtract( 3, 'months' );
assert.strictEqual(
pastRendered,
pastDate.format( 'YYYY-MM-DD' ),
'Default date string matches default date pattern'
);
const datetimeAttr = this.$( '>:first-child' ).attr( 'datetime' );
const dataOriginalTitleAttr = this.$( '>:first-child' ).attr( 'data-original-title' );
assert.strictEqual(
datetimeAttr,
dataOriginalTitleAttr,
'Attributes datetime and data-original-title match'
);
assert.strictEqual(
/^\d{4}[-]\d{2}[-]\d{2}\s\d{1,2}[:]\d{2}\s[A-Z]+$/.test( this.$( '>:first-child' ).attr( 'datetime' ) ),
true,
'Attribute datetime matches ISO datetime format plus timezone code'
);
});