Mock debounce/throttle.

This commit is contained in:
trestletech
2019-10-15 16:06:23 -05:00
parent d3a5ac4a9d
commit fa7944e096
3 changed files with 36 additions and 12 deletions

View File

@@ -223,6 +223,10 @@ testModule <- function(module, expr, args, ...) {
session$flush()
}
# Contract is to return Sys.time, which is seconds, not millis.
session$now <- function(){
timer$getElapsed()/1000
}
session$reactlog <- function(logEntry){} # TODO: Needed for mock?
session$incrementBusyCount <- function(){} # TODO: Needed for mock?

View File

@@ -116,6 +116,9 @@ MockableTimerCallbacks <- R6Class(
},
elapse = function(millis){
private$time <<- private$time + millis
},
getElapsed = function(){
private$time
}
), private = list(
time = 0L