Skip to content

Commit 4dddcd7

Browse files
add constants for millisecond amounts
Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 2a238d4 commit 4dddcd7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// constants for working with milliseconds
7+
export const oneSecond = 1000
8+
export const oneMinute = oneSecond * 60
9+
export const oneHour = oneMinute * 60
10+
export const oneDay = oneHour * 24
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import assert from 'assert'
7+
import { oneSecond, oneMinute, oneHour, oneDay } from '../../shared/datetime'
8+
9+
// Test that the following imports all equal the expected milliseconds
10+
describe('millisecond constants', () => {
11+
it('has expected milliseconds', () => {
12+
assert.strictEqual(oneSecond, 1000)
13+
assert.strictEqual(oneMinute, 1000 * 60)
14+
assert.strictEqual(oneHour, 1000 * 60 * 60)
15+
assert.strictEqual(oneDay, 1000 * 60 * 60 * 24)
16+
})
17+
})

0 commit comments

Comments
 (0)