package com.peachpasswords.autofill import org.junit.Assert.assertEquals import org.junit.Assert.assertNull import org.junit.Test /** * v2.14.6 regression: with only one inline spec offered by the framework * (common on 2FA-only pages after username/password submit), the picker * spec and OTP spec would both target specs[0] and the picker dataset, * being added last, would clobber the OTP chip inline. The picker now * falls back to the system menu in the single-spec case so the OTP chip * keeps the only inline slot. */ class AutofillPickerSpecSelectionTest { private val a = "spec-A" private val b = "spec-B" private val c = "spec-C" @Test fun empty_specs_yield_null_picker() { assertNull(pickerSpecFor(emptyList())) } @Test fun single_spec_yields_null_picker_so_otp_keeps_the_slot() { assertNull(pickerSpecFor(listOf(a))) } @Test fun two_specs_put_picker_in_the_first_slot() { assertEquals(a, pickerSpecFor(listOf(a, b))) } @Test fun three_specs_put_picker_in_the_middle_slot() { assertEquals(b, pickerSpecFor(listOf(a, b, c))) } @Test fun four_specs_put_picker_in_the_third_slot() { assertEquals(c, pickerSpecFor(listOf(a, b, c, "spec-D"))) } }