Skip to content

Commit

Permalink
test: add test for timezone()
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Nov 21, 2017
1 parent 7feda93 commit 86464ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/scripts/processors/common.js
Expand Up @@ -43,6 +43,14 @@ describe('common', () => {
should.not.exist(common.toDate('foo'));
});

it('timezone()', () => {
const d = new Date(Date.UTC(1972, 2, 29, 0, 0, 0));
const d_timezone_UTC = common.timezone(d, 'UTC');
(common.timezone(d, 'Asia/Shanghai') - d_timezone_UTC).should.eql(-8 * 3600 * 1000);
(common.timezone(d, 'Asia/Bangkok') - d_timezone_UTC).should.eql(-7 * 3600 * 1000);
(common.timezone(d, 'America/Los_Angeles') - d_timezone_UTC).should.eql(8 * 3600 * 1000);
})

it('isMatch() - string', () => {
// String
common.isMatch('foo/test.html', 'foo/*.html').should.be.true;
Expand Down

0 comments on commit 86464ce

Please sign in to comment.