Integration testing of subscriptions #4687
sabidhasan
started this conversation in
General
Replies: 1 comment
-
Hi! Yeah, testing with ActionCable can be a bit tricky. In my own case, I created a mock action cable and used that for testing as described here: #4094 (comment) What do you think of that approach? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋 from Jobber!
We have a subscription that that does an expensive calculation 🧠 and returns the data to the client asynchronously.
(Internally, the subscription kicks off a Sidekiq job which triggers the subscription with results, though this is not critical to the problem at hand).
Per the testing guidelines provided here, we have unit tests to cover the business logic around the internals of the Sidekiq job itself. However, the subscription needs some inputs to work, for which some validation is performed in the subscription class.
As far as writing integration tests for subscriptions, what are your general recommendations? We really only need test coverage for the input and authorization validations occurring in the subscription class, not the business logic, so I am not looking to test what the payload gets returned to the client. In other words, is there an easy way to test the subscription logic while removing action cable from the equation?
Would you be able to point us to examples around this, please? Thanks! 🙏
Abid at Jobber, Inc.
Beta Was this translation helpful? Give feedback.
All reactions