Skip to content

Commit

Permalink
Test for formatISO in Asia/Kolkata TZ
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikko Koponen committed Feb 6, 2020
1 parent d0c0a15 commit c0f4396
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/test/formatISO.sh
@@ -0,0 +1,12 @@
#!/bin/bash

# The script runs formatISO in a non%60 timezone offset
#
# It's a part of the test process.

set -ex

export PATH="$(yarn bin):$PATH"
export NODE_ENV=test

env TZ=Asia/Kolkata babel-node ./test/formatISO/india.js
1 change: 1 addition & 0 deletions scripts/test/travis.sh
Expand Up @@ -24,6 +24,7 @@ then
yarn test --single-run

./scripts/test/dst.sh
./scripts/test/formatISO.sh

prebuild
./scripts/test/tz.sh
Expand Down
13 changes: 13 additions & 0 deletions test/formatISO/india.js
@@ -0,0 +1,13 @@
import formatISO from '../../src/formatISO'
import assert from 'assert'

if (process.env.TZ !== 'Asia/Kolkata')
throw new Error('The test must be run with TZ=Asia/Kolkata')

if (parseInt(process.version.match(/^v(\d+)\./)[1]) < 10)
throw new Error('The test must be run on Node.js version >= 10')

assert.equal(
formatISO(new Date(1986, 3, 4, 10, 33, 1)),
'1986-04-04T10:33:01+05:30'
)

0 comments on commit c0f4396

Please sign in to comment.