-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
184 additions
and
39 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,10 +1,32 @@ | ||
recorder = require '../lib/recorder' | ||
Recorder = require '../lib/recorder' | ||
{log,error,inspect} = require 'util' | ||
delay = (t,f) -> setTimeout f, t | ||
|
||
# these are not real tests, it's more like a demo | ||
# more complete tests should check for returned values!!! | ||
|
||
# our tests | ||
describe 'Recorder', -> | ||
describe '#new Recorder()', -> | ||
it 'should work', (done) -> | ||
recorder = new Recorder() | ||
recorder.insert foo: 'bar' | ||
#if (err) throw err | ||
done() | ||
|
||
record = new Recorder() | ||
record.on 'event', (event) -> log "#{event.timestamp}: #{inspect event.data}" | ||
|
||
# record some dummy events | ||
log "recording events.." | ||
delay 100, -> record.rec companyhelpdesk: "hi how can I help you" | ||
delay 500, -> record.rec facebook: "wow! this was a big earthquake" | ||
delay 1000, -> record.rec twitter: "just saw my dead neighbor walking in my street. It's weird. wait I'm gonna check it out" | ||
delay 1500, -> record.rec twitter: "ZOMBIE APOCALYPSE!!1!!" | ||
|
||
delay 1600, -> | ||
log "playing events back.." | ||
record.play() | ||
|
||
delay 100, -> | ||
log "playing events back. and faster." | ||
record.play 5.0 # 2.0x | ||
done() | ||
|
||
#if (err) throw err |