Skip to content

Commit

Permalink
Merge pull request #16 from onlymezyb/master
Browse files Browse the repository at this point in the history
Fix 3 test cases failed when run test example nuve-test.js
  • Loading branch information
jcague committed Jul 3, 2013
2 parents f5c407b + cc467c0 commit b014a1e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions test/nuve-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe('server', function () {

room.connect();

room.publish(localStream);
waitsFor(function () {
return callback.callCount > 0;
});
Expand All @@ -81,10 +82,10 @@ describe('server', function () {
it('should publish stream in room', function () {
var callback = jasmine.createSpy("publishroom");

room.publish(localStream);

waits(20000);
room.addEventListener("stream-added", function(msg) {
remoteStream = msg.stream;
remoteStream = [];
remoteStream.push(msg.stream);
callback();
});

Expand All @@ -103,12 +104,14 @@ describe('server', function () {
room.addEventListener("stream-subscribed", function() {
callback();
});

room.subscribe(remoteStream);


for (var index in remoteStream) {
var stream = remoteStream[index];
room.subscribe(stream);
}
waitsFor(function () {
return callback.callCount > 0;
});
},"stream-subscribed should trigged", 20000);

runs(function () {
expect(callback).toHaveBeenCalled();
Expand All @@ -120,12 +123,12 @@ describe('server', function () {
divg.setAttribute("id", "myDiv");
document.body.appendChild(divg);

remoteStream.show('myDiv');
localStream.show('myDiv');

waits(500);

runs(function () {
var video = document.getElementById('stream' + remoteStream.getID());
var video = document.getElementById('stream' + localStream.getID());
expect(video.getAttribute("url")).toBeDefined();
});
});
Expand All @@ -145,4 +148,4 @@ describe('server', function () {
expect(callback).toHaveBeenCalled();
});
});
});
});

0 comments on commit b014a1e

Please sign in to comment.