• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

173
Views
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?

almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error