summaryrefslogtreecommitdiff
path: root/date-fns/src/hoursToMilliseconds/test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'date-fns/src/hoursToMilliseconds/test.ts')
-rw-r--r--date-fns/src/hoursToMilliseconds/test.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/date-fns/src/hoursToMilliseconds/test.ts b/date-fns/src/hoursToMilliseconds/test.ts
new file mode 100644
index 0000000..fdc426c
--- /dev/null
+++ b/date-fns/src/hoursToMilliseconds/test.ts
@@ -0,0 +1,20 @@
+/* eslint-env mocha */
+
+import assert from 'assert'
+import hoursToMilliseconds from '.'
+
+describe('hoursToMilliseconds', function () {
+ it('converts hours to milliseconds', function () {
+ assert(hoursToMilliseconds(1) === 3600000)
+ assert(hoursToMilliseconds(2) === 7200000)
+ })
+
+ it('uses floor rounding', () => {
+ assert(hoursToMilliseconds(0.123456) === 444441)
+ })
+
+ it('handles border values', () => {
+ assert(hoursToMilliseconds(1.5) === 5400000)
+ assert(hoursToMilliseconds(0) === 0)
+ })
+})