forked from Simon-Initiative/oli-torus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Simon-Initiative:master' into master
- Loading branch information
Showing
29 changed files
with
1,096 additions
and
155 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
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
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
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
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
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
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
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,36 @@ | ||
import { formatTimerMessage, hasExpired } from 'phoenix/countdownTimer'; | ||
|
||
it('formats the message correctly', () => { | ||
const now = new Date().getTime(); | ||
|
||
let message = formatTimerMessage(now + 1000 * 60 * 5, now); | ||
expect(message).toEqual('Time remaining: 5m 0s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 60, now); | ||
expect(message).toEqual('Time remaining: 60m 0s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 70, now); | ||
expect(message).toEqual('Time remaining: 70m 0s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 1337, now); | ||
expect(message).toEqual('Time remaining: 1337m 0s '); | ||
|
||
message = formatTimerMessage(now, now); | ||
expect(message).toEqual('Time remaining: 0m 0s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 5 + 1000, now); | ||
expect(message).toEqual('Time remaining: 5m 1s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 5 + 59000, now); | ||
expect(message).toEqual('Time remaining: 5m 59s '); | ||
|
||
message = formatTimerMessage(now + 1000 * 60 * 5 + 60000, now); | ||
expect(message).toEqual('Time remaining: 6m 0s '); | ||
}); | ||
|
||
it('determines expiration correctly', () => { | ||
const now = new Date().getTime(); | ||
expect(hasExpired(now + 1000, now)).toEqual(false); | ||
expect(hasExpired(now, now)).toEqual(false); | ||
expect(hasExpired(now - 1000, now)).toEqual(true); | ||
}); |
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
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
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
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
Oops, something went wrong.