Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

42
Vistas
Unit testing client side of WAMP webpsockets using wampy js

I'm trying to write unit tests for websocket logic but I'm struggling with mocking the server side.

In my project I use wampy.js ( https://github.com/KSDaemon/wampy.js/ ) for creating client side connection. I tried using https://github.com/romgain/jest-websocket-mock for mocking the server side of connection but I cannot figure out how to write the test case properly so that the client connects to the server.

I was trying to recreate this simple scenario but with wamp.js https://github.com/romgain/jest-websocket-mock#run-assertions-on-messages-as-they-are-received-by-the-mock-server

I'm aware I need to add a mock as described here https://github.com/romgain/jest-websocket-mock#using-jest-websocket-mock-to-interact-with-a-non-global-websocket-object

Does anyone succeeded with creating working test scenario? Is there a different solution that would work apart from jest-websocket-mock?

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos