UNPKG

stub-azure-function-context

Version:

Provides an object similar to Function Runtime's context for use in unit testing

45 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TimerBinding = void 0; class TimerBinding { data; now; constructor(timerData) { this.now = timerData.now; this.data = { isPastDue: timerData.isPastDue ?? false, schedule: { adjustForDST: timerData.adjustForDst ?? true, }, scheduleStatus: { last: new Date(timerData.now.getTime() - (timerData.interval * 1000)).toISOString(), next: new Date(timerData.now.getTime() + (timerData.interval * 1000)).toISOString(), lastUpdated: timerData.now.toISOString(), }, }; } toContextBinding() { return this.data; } toTrigger() { return this.data; } toBindingData() { const date = [ this.now.getUTCDate().toString().padStart(2, '0'), '/', (this.now.getUTCMonth() + 1).toString().padStart(2, '0'), '/', this.now.getUTCFullYear(), ' ', this.now.getUTCHours().toString().padStart(2, '0'), ':', this.now.getUTCMinutes().toString().padStart(2, '0'), ':', this.now.getUTCSeconds().toString().padStart(2, '0'), ].join(''); return { timerTrigger: date }; } } exports.TimerBinding = TimerBinding; //# sourceMappingURL=timer-binding.js.map