Testing Angular services that depend on SignalR hub route registration

982 views
Skip to first unread message

Mattias Rasmusson

unread,
Dec 7, 2013, 11:36:37 PM12/7/13
to karma...@googlegroups.com
I am using Karma v 0.8.6 to run unit tests on my AngularJS project. In the project, I am using SignalR v 1.1.3. In order to use SignalR in the code, I register the hubs with: <script src="/signalr/hubs"></script> 

I get the error: Chrome 31.0 (Windows): Executed 48 of 266[31m (29 FAILED)[39m
[1A[2K[31mChrome 31.0 (Windows) Field service query() should make get request to api/ParamSetting FAILED[39m
Error: SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/hubs'></script>.
When trying to add '/signalr/hubs' in the "files" section of the Karma config. How would I go about registering the SignalR hubs route in the Karma config file?

Vojta Jína

unread,
Dec 8, 2013, 6:43:40 PM12/8/13
to karma...@googlegroups.com
There is an answer on SO. Sorry, I don't know what signalr is, but it looks like it's running some server-side component too. I would recommend to mock this out, or you can configure Karma's proxy to proxy these requests to that serverside component of signalr.

V.


--
You received this message because you are subscribed to the Google Groups "karma-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karma-users...@googlegroups.com.
To post to this group, send email to karma...@googlegroups.com.
Visit this group at http://groups.google.com/group/karma-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/karma-users/27484a48-c217-4ca6-b329-37b7a922eca3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mattias Rasmusson

unread,
Dec 9, 2013, 1:00:21 PM12/9/13
to karma...@googlegroups.com
Thanks, Vojta. Karma makes unit testing so enjoyable, you are the man.
Reply all
Reply to author
Forward
0 new messages