From 89c6fd537f73ae8cfd2f28471548bc519a00d6c5 Mon Sep 17 00:00:00 2001 From: James Rich Date: Mon, 16 Mar 2026 10:33:54 -0500 Subject: [PATCH] conductor(checkpoint): Checkpoint end of Phase 1 --- .../core/service/AndroidFileServiceTest.kt | 32 +++++++++++++++++ .../service/AndroidLocationServiceTest.kt | 34 +++++++++++++++++++ .../core/service/JvmFileServiceTest.kt | 32 +++++++++++++++++ .../core/service/JvmLocationServiceTest.kt | 30 ++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidFileServiceTest.kt create mode 100644 core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidLocationServiceTest.kt create mode 100644 core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmFileServiceTest.kt create mode 100644 core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmLocationServiceTest.kt diff --git a/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidFileServiceTest.kt b/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidFileServiceTest.kt new file mode 100644 index 000000000..6fdcd2c1d --- /dev/null +++ b/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidFileServiceTest.kt @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.meshtastic.core.service + +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertNotNull +import org.junit.Test +import io.mockk.mockk +import android.app.Application + +class AndroidFileServiceTest { + @Test + fun testInitialization() = runTest { + val mockContext = mockk(relaxed = true) + val service = AndroidFileService(mockContext) + assertNotNull(service) + } +} diff --git a/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidLocationServiceTest.kt b/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidLocationServiceTest.kt new file mode 100644 index 000000000..44435b7e6 --- /dev/null +++ b/core/service/src/androidUnitTest/kotlin/org/meshtastic/core/service/AndroidLocationServiceTest.kt @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2026 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.meshtastic.core.service + +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertNotNull +import org.junit.Test +import io.mockk.mockk +import org.meshtastic.core.repository.LocationRepository +import android.app.Application + +class AndroidLocationServiceTest { + @Test + fun testInitialization() = runTest { + val mockContext = mockk(relaxed = true) + val mockRepo = mockk(relaxed = true) + val service = AndroidLocationService(mockContext, mockRepo) + assertNotNull(service) + } +} diff --git a/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmFileServiceTest.kt b/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmFileServiceTest.kt new file mode 100644 index 000000000..e74a911eb --- /dev/null +++ b/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmFileServiceTest.kt @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2026 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.meshtastic.core.service + +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertFalse +import org.junit.Test +import org.meshtastic.core.common.util.MeshtasticUri + +class JvmFileServiceTest { + @Test + fun testWriteAndRead() = runTest { + val service = JvmFileService() + // Just verify it doesn't crash on invalid paths for now. + val result = service.read(MeshtasticUri("invalid_file_path.txt")) { } + assertFalse(result) + } +} diff --git a/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmLocationServiceTest.kt b/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmLocationServiceTest.kt new file mode 100644 index 000000000..5db50f233 --- /dev/null +++ b/core/service/src/jvmTest/kotlin/org/meshtastic/core/service/JvmLocationServiceTest.kt @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2026 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.meshtastic.core.service + +import kotlinx.coroutines.test.runTest +import org.junit.Assert.assertNull +import org.junit.Test + +class JvmLocationServiceTest { + @Test + fun testGetCurrentLocationReturnsNullOnJvm() = runTest { + val service = JvmLocationService() + val location = service.getCurrentLocation() + assertNull(location) + } +}