Cotton code
35 lines · 1.6 KB · KotlinRaw
package com.cottondb.daysimport android.app.Applicationimport org.robolectric.RuntimeEnvironmentimport java.io.Fileimport org.junit.Assert.assertTrueimport org.junit.Testimport org.junit.runner.RunWithimport org.robolectric.RobolectricTestRunnerimport org.robolectric.annotation.Config/** * Days took the to-dos over from Todos, and with them the reminders (coordinator, 22 Nov 2026): on Android only Todos * turned the shell's reminder pass on, so Days posted none. */@RunWith(RobolectricTestRunner::class)@Config(sdk = [35], application = Application::class)class DaysRemindersTest {    private val repo = generateSequence(File("").absoluteFile) { it.parentFile }.first { File(it, "apps/registry.json").isFile }    /** RULE: Days posts the core's reminders, and its manifest carries what posting them needs: leave to notify, the receiver that posts one, and the one that puts them back after a restart or an update. */    @Test    fun days_posts_the_cores_reminders() {        assertTrue("Days runs the reminder pass", DaysParts(RuntimeEnvironment.getApplication()).reminds)        val manifest = File(repo, "apps/android/app/src/days/AndroidManifest.xml").readText()        for (needed in listOf(            "android.permission.POST_NOTIFICATIONS",            "android.permission.RECEIVE_BOOT_COMPLETED",            "com.cottondb.shell.ReminderReceiver",            "com.cottondb.shell.RebootReceiver",            "android.intent.action.BOOT_COMPLETED",            "android.intent.action.MY_PACKAGE_REPLACED",        )) assertTrue("Days' manifest names $needed", manifest.contains(needed))    }}