Node.js
Avancé
Writing unit tests for Express services with Jest and mocking

Type d'évaluation

Mise en situation réelle

Analyse

Intelligence Artificielle

Compétences ciblées

nodejs
jest
unit-testing
mocking
coverage

Scénario Technique

Context A user service containing business logic has no tests. Every change requires manual verification and regressions frequently reach production. The Problem The service has no test coverage, and its dependencies (database, external APIs) make it hard to test in isolation. Constraints Write Jest unit tests for at least three service functions. Mock all external dependencies using jest.mock(). Test both success paths and error paths. Achieve 80 percent or more code coverage for the service module. Expected Deliverable A Jest test suite for a Node.js service module, with mocked dependencies, coverage of happy and error paths, and at least 80 percent code coverage.

Prêt à évaluer ce talent ?

Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.

Commencer le Défis
    Node.js - Writing unit tests for Express services with Jest and mocking | Défi Technique & Recrutement — CodeDuel