Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make ns module public #545

Levi-Montgomery started this conversation in General
Make ns module public #545
Jul 17, 2025 * 2 comments * 1 reply
Return to top
Discussion options

Levi-Montgomery
Jul 17, 2025

Is your feature request related to a problem? Please describe.
I am trying to use the Socket::new_dummy when I have the feature flag enabled. However, it requires a NameSpace argument that is in the ns module which is private.

Describe the solution you'd like
I would like ns module to be made public, or somehow otherwise make the NameSpace public.

I need this so i can write unit tests.

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

Totodore
Jul 18, 2025
Maintainer

Out of curiosity, why do you need Socket::new_dummy? Is it for testing things on your own side? It was made only for internal testing purposes.

You must be logged in to vote
0 replies
Comment options

Levi-Montgomery
Jul 18, 2025
Author

So any function I write that has an argument like socket: SocketRef, that I need to write a unit test for I need some way of having a dummy socket to pass into it. Or even a simple real socket would work really.
Socket::new_dummy should work based on what i read.

I understand I can use axum to test at a higher level but that doesn't count for the coverage report and unfortunately that's what I'm graded on. My only alternative that i can think of at least is transmute but that raises flags too lol

You must be logged in to vote
1 reply
Comment options

Totodore Jul 20, 2025
Maintainer

I understand that this lib needs better testability. However I won't make the ns module public for this purpose. It needs a better design, Socket::new_dummy was only for internal testing and it is not ready for this public faced feature.

If you really want to make your handler unit testable you can:

Feel free to ask more details on this discussion or on the tokio discord in the socketioxide channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #543 on July 20, 2025 07:36.