RelaySettingsPropagationTest.kt

913 B · raw

1package com.peachpasswords.sync23import org.junit.Assert.assertEquals4import org.junit.Test56class RelaySettingsPropagationTest {7    @Test8    fun changing_mesh_relay_updates_every_existing_pair() {9        val devices = listOf(10            PairedDevice(11                deviceId = "browser",12                relayUrl = "wss://old-relay.example",13                pairedAt = 1L,14            ),15            PairedDevice(16                deviceId = "phone",17                relayUrl = null,18                pairedAt = 2L,19            ),20        )2122        val updated = withRelayUrl(devices, "wss://new-relay.example/base")2324        assertEquals(25            listOf(26                "wss://new-relay.example/base",27                "wss://new-relay.example/base",28            ),29            updated.map { it.relayUrl },30        )31        assertEquals(listOf("browser", "phone"), updated.map { it.deviceId })32    }33}