tessl install tessl/npm-jest-circus@29.7.0The next-gen flux-based test runner for Jest that provides test framework globals and event-driven test execution
Agent Success
Agent success rate when using this tile
82%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.91x
Baseline
Agent success rate without this tile
43%
Build a notification handler that processes email events using callback functions. The handler should accept callback functions for different email events and invoke them with the appropriate data.
Implement a NotificationHandler class with the following functionality:
Accept three callback functions in the constructor:
onEmailSent: Called when an email is successfully sentonEmailFailed: Called when an email fails to sendonEmailQueued: Called when an email is queued for sendingProvide a processEmail method that:
to, subject, status (one of: 'sent', 'failed', 'queued')Provide a processBatch method that:
processEmail method@generates
/**
* NotificationHandler manages callbacks for email events
*/
class NotificationHandler {
/**
* @param {Object} callbacks - Callback functions for email events
* @param {Function} callbacks.onEmailSent - Called when email is sent
* @param {Function} callbacks.onEmailFailed - Called when email fails
* @param {Function} callbacks.onEmailQueued - Called when email is queued
*/
constructor(callbacks) {
// Implementation
}
/**
* Process a single email and invoke the appropriate callback
* @param {Object} email - Email object with to, subject, and status
*/
processEmail(email) {
// Implementation
}
/**
* Process multiple emails
* @param {Array<Object>} emails - Array of email objects
* @returns {number} Total number of emails processed
*/
processBatch(emails) {
// Implementation
}
}
module.exports = { NotificationHandler };Provides testing framework and mocking capabilities.