(nestedCmd, delayMs, options, cmdType, funcName)
| 312 | } |
| 313 | |
| 314 | function delay(nestedCmd, delayMs, options, cmdType, funcName) { |
| 315 | if (process.env.NODE_ENV !== 'production') { |
| 316 | throwInvariant( |
| 317 | isCmd(nestedCmd), |
| 318 | `${funcName}: first argument must be another Cmd` |
| 319 | ); |
| 320 | throwInvariant( |
| 321 | typeof delayMs === 'number', |
| 322 | `${funcName}: second argument must be a number` |
| 323 | ); |
| 324 | throwInvariant( |
| 325 | typeof options === 'object', |
| 326 | `${funcName}: third argument must be an options object` |
| 327 | ); |
| 328 | throwInvariant( |
| 329 | options.scheduledActionCreator === undefined || |
| 330 | typeof options.scheduledActionCreator === 'function', |
| 331 | `${funcName}: scheduledActionCreator option must be a function if specified` |
| 332 | ); |
| 333 | } |
| 334 | |
| 335 | return Object.freeze({ |
| 336 | [isCmdSymbol]: true, |
| 337 | type: cmdType, |
| 338 | nestedCmd, |
| 339 | delayMs, |
| 340 | scheduledActionCreator: options.scheduledActionCreator, |
| 341 | simulate: simulateDelay, |
| 342 | }); |
| 343 | } |
| 344 | |
| 345 | function simulateDelay(timerId, nestedSimulation) { |
| 346 | let result = this.nestedCmd.simulate(nestedSimulation); |
no test coverage detected