1package com.peachpasswords.autofill23import com.peachpasswords.vault.VaultEntry4import org.junit.Assert.assertEquals5import org.junit.Test67class AutofillMatchTest {8 private fun entry(title: String, url: String?) =9 VaultEntry(id = title, title = title, url = url, createdAt = 0, modifiedAt = 0)1011 @Test fun domain_match_ranks_first() {12 val gh = entry("GitHub", "https://github.com/login")13 val mail = entry("Fastmail", "https://fastmail.com")14 val ranked = AutofillResponseBuilder.matchEntries(listOf(mail, gh), "login.github.com")15 assertEquals("GitHub", ranked.first().title)16 }1718 @Test fun subdomain_origin_matches_core_label() {19 val gh = entry("GitHub", "https://github.com")20 val ranked = AutofillResponseBuilder.matchEntries(listOf(gh), "https://gist.github.com/")21 assertEquals("GitHub", ranked.first().title)22 }2324 @Test fun no_origin_returns_all_unchanged() {25 val a = entry("A", null)26 val b = entry("B", null)27 assertEquals(listOf(a, b), AutofillResponseBuilder.matchEntries(listOf(a, b), null))28 }29}