import { deepStrictEqual } from "assert" ; import { readFileSync } from "fs" ; import { Connection } from "../src/ice" ; export function readMessage ( name ) { const data = readFileSync ( "./tests/data/" + name ) ; return data ; } export async function inviteAccept ( a , b ) { await a . gatherCandidates ( ) ; b . remoteCandidates = a . localCandidates ; b . remoteUsername = a . localUserName ; b . remotePassword = a . localPassword ; await b . gatherCandidates ( ) ; a . remoteCandidates = b . localCandidates ; a . remoteUsername = b . localUserName ; a . remotePassword = b . localPassword ; } export function assertCandidateTypes ( conn , expected ) { const types = conn . localCandidates . map ( ( v ) => v . type ) ; deepStrictEqual ( new Set ( types ) , new Set ( expected ) ) ; }