-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add constants for millisecond amounts
Signed-off-by: nkomonen-amazon <[email protected]>
- Loading branch information
1 parent
2a238d4
commit 4dddcd7
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// constants for working with milliseconds | ||
export const oneSecond = 1000 | ||
export const oneMinute = oneSecond * 60 | ||
export const oneHour = oneMinute * 60 | ||
export const oneDay = oneHour * 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/*! | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import assert from 'assert' | ||
import { oneSecond, oneMinute, oneHour, oneDay } from '../../shared/datetime' | ||
|
||
// Test that the following imports all equal the expected milliseconds | ||
describe('millisecond constants', () => { | ||
it('has expected milliseconds', () => { | ||
assert.strictEqual(oneSecond, 1000) | ||
assert.strictEqual(oneMinute, 1000 * 60) | ||
assert.strictEqual(oneHour, 1000 * 60 * 60) | ||
assert.strictEqual(oneDay, 1000 * 60 * 60 * 24) | ||
}) | ||
}) |