Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaboleken committed Dec 5, 2024
1 parent 52e8bd4 commit 7cc1bda
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/test/js/media_manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ describe("MediaManager", function () {
navigator.mediaDevices.getUserMedia.restore();
});


/*
it("should call onEndedCallback when desktop stream ends", async function () {
var adaptor = new WebRTCAdaptor({
websocketURL: "ws://localhost",
Expand All @@ -392,6 +390,28 @@ describe("MediaManager", function () {
initializeComponents: false
});

var mediaManager = new MediaManager({
userParameters: {
mediaConstraints: {
video: false,
audio: true,
}
},
webRTCAdaptor: adaptor,

callback: (info, obj) => {
adaptor.notifyEventListeners(info, obj)
},
callbackError: (error, message) => {
adaptor.notifyErrorEventListeners(error, message)
},
getSender: (streamId, type) => {
return adaptor.getSender(streamId, type)
},
});

adaptor.mediaManager = mediaManager;

await adaptor.initialize();

// Create a mock video track
Expand All @@ -404,6 +424,10 @@ describe("MediaManager", function () {
onended: sinon.fake(),
};

// Create a desktop stream
const stream = new MediaStream();
stream.getVideoTracks = () => [mockVideoTrack]; // Override `getVideoTracks`

// Create a fake `MediaStream` and add the mock video track
const cameraStream = new MediaStream();
cameraStream.getVideoTracks = () => [mockVideoTrack]; // Override `getVideoTracks`
Expand All @@ -418,8 +442,6 @@ describe("MediaManager", function () {
navigator.mediaDevices.getUserMedia.restore();
});

*/

it("should update offscreen canvas at regular intervals", async function () {
var adaptor = new WebRTCAdaptor({
websocketURL: "ws://localhost",
Expand Down

0 comments on commit 7cc1bda

Please sign in to comment.