Skip to content

Commit

Permalink
Pin the browser timezone to a specific timezone
Browse files Browse the repository at this point in the history
This is useful since developers (and CI) will run these tests in
different timezones.
  • Loading branch information
koddsson committed May 6, 2021
1 parent f0c47d7 commit 0ee2968
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build": "tsc && rollup -c",
"prepublishOnly": "npm run build",
"pretest": "npm run build",
"test": "karma start ./test/karma.config.cjs",
"test": "TZ=Asia/Dubai karma start ./test/karma.config.cjs",
"postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'"
},
"prettier": "@github/prettier-config",
Expand Down
6 changes: 3 additions & 3 deletions test/local-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ suite('local-time', function () {
window.CustomElements.upgradeSubtree(root)
}
assert.match(root.children[0].textContent, /^\d{1,2} (\w+([+-]\d+)?)$/)
assert.equal(root.children[0].textContent, '0 GMT+1')
assert.equal(root.children[0].textContent, '0 GMT+4')
})

test('updates time zone when the `time-zone-name` attribute changes', function () {
Expand All @@ -104,10 +104,10 @@ suite('local-time', function () {
el.setAttribute('time-zone-name', 'short')

fixture.appendChild(el)
assert.equal(el.textContent, '1/1/1970, GMT+1')
assert.equal(el.textContent, '1/1/1970, GMT+4')

el.setAttribute('time-zone-name', 'long')

assert.equal(el.textContent, '1/1/1970, GMT+01:00')
assert.equal(el.textContent, '1/1/1970, Gulf Standard Time')
})
})

0 comments on commit 0ee2968

Please sign in to comment.