Skip to content

Commit

Permalink
adding basic sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
caridy committed May 16, 2016
1 parent 41ada9e commit e1b81ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intl",
"version": "1.2.1",
"version": "1.2.2",
"description": "Polyfill the ECMA-402 Intl API (except collation)",
"main": "index.js",
"directories": {
Expand Down Expand Up @@ -72,7 +72,7 @@
"build:dist": "npm run build:dist:dev && npm run build:dist:prod",
"build": "npm run build:data && npm run build:lib && npm run build:dist",
"lint": "eslint .",
"test": "cd tests && node noderunner.js && node saucelabs.js",
"test": "cd tests && node sanity.js && node noderunner.js && node saucelabs.js",
"pretest": "npm run lint",
"preversion": "npm run clean && npm run build && npm run test",
"prepublish": "npm run clean && npm run build"
Expand Down
24 changes: 24 additions & 0 deletions tests/sanity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var IntlPolyfill = require('../');

function assert(value, expected) {
if (value !== expected) {
console.log('expected value ' + expected + ' but the actual value is ' + value);
process.exit(1);
}
}

assert(new IntlPolyfill.NumberFormat('de-DE', {
minimumFractionDigits: 2,
maximumFractionDigits: 2
}).format(0.015), "0,02");

assert(new IntlPolyfill.NumberFormat('en-US', {
style: 'currency',
currency: 'GBP',
minimumFractionDigits: 2,
}).format(59.88), '£59.88');

assert(new IntlPolyfill.DateTimeFormat('en', {
month:'numeric',
day: 'numeric'
}).format(new Date('2016/05/16')), '5/16');

0 comments on commit e1b81ae

Please sign in to comment.