-
Notifications
You must be signed in to change notification settings - Fork 3
/
spec.decimal.js
33 lines (29 loc) · 1.14 KB
/
spec.decimal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";
require("should");
var Muenchhausen = require("../lib");
var muenchhausen = new Muenchhausen("de-DE");
describe("muenchhausen decimal", function () {
it("should render a decimal!", function () {
var merchandiseTVSpotText = "$(decimal.random)";
var news = muenchhausen.render(merchandiseTVSpotText);
news.length.should.above(0);
});
it("should render a decimal between 100 and 200!", function () {
var merchandiseTVSpotText = "$(decimal.random.value min:100,max:200)";
var news = muenchhausen.render(merchandiseTVSpotText);
var i = parseFloat(news);
i.should.above(100);
i.should.below(200);
});
it("should render a decimal between 100 and 200 with 3 decimal places!", function () {
var merchandiseTVSpotText = "$(decimal.random min:100,max:200,decimalplaces:3)";
var news = muenchhausen.render(merchandiseTVSpotText);
var i = parseInt(news);
i.should.above(100);
i.should.below(200);
var s = news.split(muenchhausen.fake.decimal.i18n.numberFormatInfo.NumberDecimalSeparator);
s.length.should.equal(2);
var e = s[s.length - 1];
e.length.should.equal(3);
});
});