Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit e1b81ae

Browse files
committed
adding basic sanity checks
1 parent 41ada9e commit e1b81ae

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intl",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Polyfill the ECMA-402 Intl API (except collation)",
55
"main": "index.js",
66
"directories": {
@@ -72,7 +72,7 @@
7272
"build:dist": "npm run build:dist:dev && npm run build:dist:prod",
7373
"build": "npm run build:data && npm run build:lib && npm run build:dist",
7474
"lint": "eslint .",
75-
"test": "cd tests && node noderunner.js && node saucelabs.js",
75+
"test": "cd tests && node sanity.js && node noderunner.js && node saucelabs.js",
7676
"pretest": "npm run lint",
7777
"preversion": "npm run clean && npm run build && npm run test",
7878
"prepublish": "npm run clean && npm run build"

tests/sanity.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
var IntlPolyfill = require('../');
2+
3+
function assert(value, expected) {
4+
if (value !== expected) {
5+
console.log('expected value ' + expected + ' but the actual value is ' + value);
6+
process.exit(1);
7+
}
8+
}
9+
10+
assert(new IntlPolyfill.NumberFormat('de-DE', {
11+
minimumFractionDigits: 2,
12+
maximumFractionDigits: 2
13+
}).format(0.015), "0,02");
14+
15+
assert(new IntlPolyfill.NumberFormat('en-US', {
16+
style: 'currency',
17+
currency: 'GBP',
18+
minimumFractionDigits: 2,
19+
}).format(59.88), '£59.88');
20+
21+
assert(new IntlPolyfill.DateTimeFormat('en', {
22+
month:'numeric',
23+
day: 'numeric'
24+
}).format(new Date('2016/05/16')), '5/16');

0 commit comments

Comments
 (0)