Switched to HTML5
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { TestCase } from "./framework/test_case.js";
|
||||
import { groupDigits, compact, hours, improvements } from "../shared/text_format.js";
|
||||
|
||||
export class TextFormatTest extends TestCase {
|
||||
test_group_digits() {
|
||||
this.assertEqual(groupDigits(0), "0");
|
||||
this.assertEqual(groupDigits(7), "7");
|
||||
this.assertEqual(groupDigits(123), "123");
|
||||
this.assertEqual(groupDigits(1234), "1 234");
|
||||
this.assertEqual(groupDigits(1234567), "1 234 567");
|
||||
this.assertEqual(groupDigits(-1234), "-1 234");
|
||||
}
|
||||
|
||||
test_compact() {
|
||||
this.assertEqual(compact(0), "0");
|
||||
this.assertEqual(compact(7), "7");
|
||||
this.assertEqual(compact(999), "999");
|
||||
this.assertEqual(compact(1234), "1.23K");
|
||||
this.assertEqual(compact(1234567), "1.23M");
|
||||
this.assertEqual(compact(999950), "1M");
|
||||
this.assertEqual(compact(-2500), "-2.5K");
|
||||
}
|
||||
|
||||
test_hours() {
|
||||
this.assertEqual(hours(0.5), "0.50 h");
|
||||
this.assertEqual(hours(2.25), "2.3 h");
|
||||
}
|
||||
|
||||
test_improvements() {
|
||||
this.assertEqual(improvements([]), "None");
|
||||
this.assertEqual(improvements(["Eiffel Tower", "Louvre"]), "Eiffel Tower, Louvre");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user