Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7112556
time-units.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
time-units.test.js
View Options
const
time_units
=
require
(
"./time-units"
);
const
assert
=
require
(
"assert"
);
describe
(
"time-units-function"
,
()
=>
{
const
formats
=
{
hours
:
[
"h"
,
3600000
],
minutes
:
[
"m"
,
60000
],
seconds
:
[
"s"
,
1000
],
miliseconds
:
[
"ms"
,
1
],
};
describe
(
"convertion"
,
()
=>
{
Object
.
keys
(
formats
).
forEach
(
format
=>
{
it
(
`should convert
${
format
}
to hours`
,
()
=>
{
const
result
=
time_units
(
formats
[
format
][
0
],
"h"
,
1
);
assert
.
equal
(
result
,
(
formats
[
format
][
1
]
/
3600000
).
toPrecision
(
8
)
);
});
it
(
`should convert
${
format
}
to minutes`
,
()
=>
{
const
result
=
time_units
(
formats
[
format
][
0
],
"m"
,
1
);
assert
.
equal
(
result
,
(
formats
[
format
][
1
]
/
60000
).
toPrecision
(
8
)
);
});
it
(
`should convert
${
format
}
to seconds`
,
()
=>
{
const
result
=
time_units
(
formats
[
format
][
0
],
"s"
,
1
);
assert
.
equal
(
result
,
(
formats
[
format
][
1
]
/
1000
).
toPrecision
(
8
)
);
});
it
(
`should convert
${
format
}
to miliseconds`
,
()
=>
{
const
result
=
time_units
(
formats
[
format
][
0
],
"ms"
,
1
);
assert
.
equal
(
result
,
(
formats
[
format
][
1
]
/
1
).
toPrecision
(
8
));
});
});
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 20:18 (7 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
799713
Default Alt Text
time-units.test.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment