Skip to content

Commit 05c1afb

Browse files
committed
more tests
1 parent 9bc4f70 commit 05c1afb

5 files changed

Lines changed: 44 additions & 3 deletions

File tree

test/src/feathers/formatters/TestCurrencyFormatter.hx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@ class TestCurrencyFormatter extends Test {
1818
var result = _formatter.format("1234567890");
1919
Assert.equals("$1,234,567,890", result);
2020
}
21+
22+
public function testDefaultsInteger():Void {
23+
var result = _formatter.format(1234567890);
24+
Assert.equals("$1,234,567,890", result);
25+
}
26+
27+
public function testDefaultsFloat():Void {
28+
var result = _formatter.format(1234567.89);
29+
Assert.equals("$1,234,567.89", result);
30+
}
2131
}

test/src/feathers/formatters/TestDateFormatter.hx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ class TestDateFormatter extends Test {
1919
Assert.equals("09/03/1981", result);
2020
}
2121

22+
public function testDefaultsWithString():Void {
23+
var result = _formatter.format("1981-09-03");
24+
Assert.equals("09/03/1981", result);
25+
}
26+
27+
public function testDefaultsWithInvalidType():Void {
28+
var result = _formatter.format(12345);
29+
Assert.equals("", result);
30+
Assert.equals(Formatter.defaultInvalidValueError, _formatter.error);
31+
}
32+
2233
public function testFormatString():Void {
2334
_formatter.formatString = "DD/MM/YYYY";
2435
var result = _formatter.format(new Date(1981, 8, 3, 0, 0, 0));

test/src/feathers/formatters/TestNumberFormatter.hx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ class TestNumberFormatter extends Test {
1414
_formatter = null;
1515
}
1616

17-
public function testDefaults():Void {
17+
public function testDefaultsString():Void {
1818
var result = _formatter.format("1234567890");
1919
Assert.equals("1,234,567,890", result);
2020
}
21+
22+
public function testDefaultsInteger():Void {
23+
var result = _formatter.format(1234567890);
24+
Assert.equals("1,234,567,890", result);
25+
}
26+
27+
public function testDefaultsFloat():Void {
28+
var result = _formatter.format(1234567.89);
29+
Assert.equals("1,234,567.89", result);
30+
}
2131
}

test/src/feathers/formatters/TestPhoneFormatter.hx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ class TestPhoneFormatter extends Test {
1414
_formatter = null;
1515
}
1616

17-
public function testDefaults():Void {
17+
public function testDefaultsString():Void {
1818
var result = _formatter.format("1234567890");
1919
Assert.equals("(123) 456-7890", result);
2020
}
21+
22+
public function testDefaultsInteger():Void {
23+
var result = _formatter.format(1234567890);
24+
Assert.equals("(123) 456-7890", result);
25+
}
2126
}

test/src/feathers/formatters/TestZipCodeFormatter.hx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ class TestZipCodeFormatter extends Test {
1414
_formatter = null;
1515
}
1616

17-
public function testDefaults():Void {
17+
public function testDefaultsString():Void {
1818
var result = _formatter.format("12345");
1919
Assert.equals("12345", result);
2020
}
21+
22+
public function testDefaultsInteger():Void {
23+
var result = _formatter.format(12345);
24+
Assert.equals("12345", result);
25+
}
2126
}

0 commit comments

Comments
 (0)