Closed vhf closed 9 years ago
I rarely use QUnit, so it's difficult for me to comment specifically on that, but did you add EmberSockets
to your Ember.Application
when bootstrapping the unit-tests? I assume you have, so I'm afraid I'm not quite sure on that.
However, generally, in testing EmberSockets
it should simply be a case of obtaining an instance of it, and then invoking emit
with your expected events. Ensure that the necessary functions are invoked using spies – Jasmine have native spies with spyOn
, but I'm not entirely sure how you would implement spies in QUnit.
Do you have any unit-test implementation which I can take a look at, please?
did you add EmberSockets to your Ember.Application when bootstrapping the unit-tests?
I did not. Any idea where I should do this?
When I put
var Socket = EmberSockets.extend({
host: 'localhost',
secure: false,
port: 8444,
controllers: [
'channels/index',
],
autoConnect: true
});
In my start-app.js, I got an "EmberSockets is not defined" error.
You also need to include EmberSockets
as part of your unit-tests :+1:
having this same issue. not entirely sure how to add EmberSockets to my unit-tests. any tips? thanks
Did @vhf have any luck with his integration?
Nope.
@Wildhoney @vhf so i sort of kind of figured it out:
in my acceptance tests, i used application.__container__.lookup('socket:main');
to get an instance of the class. then using sinon.js, i stubbed the methods out. this helped me test
additionally, i had to make some changes to the source to make stubbing easier
That's good :+1: For PR #51 I would recommend Ember specific functions though, as @fsmanuel pointed out.
First of all, thanks for your good work.
I did not find anything in the README about testing. How would you go about unit testing (qunit w/ember-cli) an app using EmberSockets?
Also, my app works great with EmberSockets, but the first qunit test
SocketioInitializer
fails with(ember-sockets 0.6.10, ember-cli 0.1.9)