npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tintin0013/tintin-ci-cd-ynov

v2.0.0

Published

Application React avec routing, architecture API découplée (Axios + JSONPlaceholder) et stratégie complète de tests (Unitaires + Intégration + E2E) avec CI/CD et déploiement automatique.

Downloads

704

Readme

Annuaire Utilisateurs React

Application React avec routing, architecture API découplée (Axios + JSONPlaceholder) et stratégie complète de tests (Unitaires + Intégration + E2E) avec CI/CD et déploiement automatique.


Objectif pédagogique

Ce projet met en place une architecture complète autour de :

  • Tests unitaires\
  • Tests d'intégration\
  • Tests E2E avec Cypress\
  • Isolation du front-end via mocking des appels API\
  • Gestion des erreurs serveur (400 / 500)\
  • Couverture de code (Codecov)\
  • Génération automatique de documentation (JSDoc)\
  • Pipeline CI/CD avec GitHub Actions\
  • Déploiement automatique via GitHub Pages

Technologies

  • React\
  • React Router (HashRouter pour GitHub Pages)\
  • Axios\
  • JSONPlaceholder\
  • Jest\
  • Cypress\
  • GitHub Actions\
  • Codecov\
  • GitHub Pages

Fonctionnalités

  • Inscription d'utilisateurs avec validation\
  • Appels API via Axios (GET /users, POST /users)\
  • Affichage dynamique de la liste des inscrits\
  • Routing entre Home et Register\
  • Validation métier (âge, email, code postal...)\
  • Gestion des erreurs métier (400 -- email déjà existant)\
  • Gestion des erreurs serveur (500 -- crash backend)\
  • Tests unitaires et d'intégration Jest avec mocking\
  • Tests E2E Cypress avec interception réseau\
  • Déploiement automatique à chaque push

Évolution d'architecture

Le projet ne repose plus sur localStorage.

L'application est désormais découplée du backend via :

  • Un service API : src/services/api.js\
  • Axios pour les appels réseau\
  • JSONPlaceholder comme API cible

Routes implémentées :

  • GET /users\
  • POST /users

Les composants ne connaissent pas Axios directement : ils passent par le service API.


Stratégie de Tests

Tests Jest (Unitaires + Intégration)

Les appels API sont entièrement mockés :

jest.mock('axios')

Cas testés :

  • Succès 200 (GET)
  • Succès 201 (POST)
  • Erreur métier 400
  • Erreur serveur 500
  • Gestion asynchrone avec async/await
  • Utilisation de waitFor pour tester les changements d'état UI

Aucun appel réseau réel ne sort des tests Jest.


Tests Cypress (E2E)

Les appels API sont interceptés :

cy.intercept()

Cas simulés :

  • GET 200
  • POST 201
  • POST 400
  • POST 500

Les tests E2E fonctionnent sans backend réel.


Livrables

  • Dépôt GitHub
    https://github.com/tintin0013/tp-test-mock

  • Application déployée
    https://tintin0013.github.io/tp-test-mock/

  • Documentation JSDoc
    https://tintin0013.github.io/tp-test-mock/docs/

  • Tableau Codecov
    https://codecov.io/gh/tintin0013/tp-test-mock


Organisation du projet

  • src/services/api.js → Service Axios\
  • src/components/ → Home & Register\
  • src/module/ → Logique métier & validations\
  • *.test.js → Tests Jest\
  • cypress/ → Tests E2E\
  • .github/workflows/ → Pipeline CI/CD\
  • public/docs/ → Documentation générée automatiquement

▶ Démarrage rapide

git clone https://github.com/tintin0013/tp-test-mock.git
cd tp-test-mock
npm install
npm start

Application accessible sur :

http://localhost:3000


Exécuter les tests

Tests unitaires et intégration

npm test

Tests Cypress E2E

npm run cypress

Build & Déploiement

npm run build

Le déploiement sur GitHub Pages est automatique via GitHub Actions lors d'un push sur main.


Documentation

npm run jsdoc

La documentation est :

  • Générée en CI\
  • Copiée dans build/docs\
  • Déployée automatiquement

CI/CD

À chaque push sur main, le workflow :

  1. Installe les dépendances\
  2. Génère la documentation JSDoc\
  3. Lance les tests unitaires avec coverage\
  4. Envoie la couverture vers Codecov\
  5. Lance les tests Cypress\
  6. Build le projet\
  7. Déploie automatiquement sur GitHub Pages

Conclusion

Ce projet met en place :

  • Architecture découplée via API\
  • Isolation complète du front-end\
  • Gestion des erreurs 400 / 500\
  • Tests unitaires mockés\
  • Tests E2E interceptés\
  • Couverture suivie avec Codecov\
  • Documentation automatique\
  • CI/CD complet\
  • Déploiement automatisé

Projet réalisé dans un cadre pédagogique pour maîtriser le mocking, la résilience UI et l'automatisation complète d'un front-end React.