extending ring test

This commit is contained in:
balzack 2025-03-09 22:30:27 -07:00
parent b12f7e2883
commit 2abfc42148

View File

@ -26,11 +26,20 @@ jest.mock('../src/link', () => {
})
test('rings correctly', async () => {
let calling = [] as { cardId: string, callId: string }[];
const endContactCall = async (cardId: string, callId: string) => {
console.log("ending");
}
};
const ringing = (calls: { cardId: string, callId: string }[]) => {
calling = calls;
};
const log = new ConsoleLogging();
const ringModule = new RingModule(log, endContactCall);
});
ringModule.addRingingListener(ringing);
ringModule.ring({ cardId: 'card1', callId: 'call1', calleeToken: 'token1', ice: [] });
await waitFor(() => calling.length === 1);
await waitFor(() => calling.length === 0, 10);
ringModule.close();
}, 15000);