package com.foxx.androidcast.dev;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

public class DevAdbWifiHelperTest {
    @Test
    public void parseDumpsysEndpoints_findsHostPortPairs() {
        String dumpsys = "mTLS port: 37145\n"
                + "registered: 192.168.33.106:37145\n"
                + "noise 10.0.0.1:5";
        List<String> endpoints = DevAdbWifiHelper.parseDumpsysEndpoints(dumpsys);
        assertTrue(endpoints.contains("192.168.33.106:37145"));
        assertEquals(1, endpoints.size());
    }

    @Test
    public void mergeEndpoints_buildsCartesianProduct() {
        List<String> connect = DevAdbConnectInfo.mergeEndpoints(
                Arrays.asList("192.168.1.2"),
                Arrays.asList(5555, 37145));
        assertEquals(Arrays.asList("192.168.1.2:5555", "192.168.1.2:37145"), connect);
    }
}
