Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Fix failing test on master due to DST #12046

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions client/components/post-schedule/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ describe( 'gmtOffset', () => {
} );

describe( 'getLocalizedDate', () => {
// Use a fixed "now" to prevent issues with DST
const now = new Date( 2017, 1, 1, 0, 0, 0 );

it( 'Should return a date localized at Amsterdam (utc: 60 minutes)', () => {
const nowInAmsterdam = getLocalizedDate( new Date(), 'Europe/Amsterdam' );
const nowInAmsterdam = getLocalizedDate( now, 'Europe/Amsterdam' );
expect( nowInAmsterdam.utcOffset() ).to.equal( 60 );
} );

it( 'Should return a date localized at New York (utc: -300 minutes)', () => {
const nowInNewYork = getLocalizedDate( new Date(), 'America/New_York' );
const nowInNewYork = getLocalizedDate( now, 'America/New_York' );
expect( nowInNewYork.utcOffset() ).to.equal( -300 );
} );

it( 'Should return a date localized at UTC+3:30 (utc: 210 minutes)', () => {
const NowAtUTC3_30 = getLocalizedDate( new Date(), false, 210 );
const NowAtUTC3_30 = getLocalizedDate( now, false, 210 );
expect( NowAtUTC3_30.utcOffset() ).to.equal( 210 );
} );
} );
Expand Down