From 268c2fb25b45003d8bb5534587dffa97d7bbdfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Tr=C3=A9guier?= Date: Wed, 31 Jul 2024 21:11:40 +0200 Subject: [PATCH] Run tests --- .github/workflows/publishing.yml | 23 ++++++++++++++++++- .../test/navigation/DestinationTests.kt | 10 ++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 8f7e5c7b..22390d2c 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -77,10 +77,31 @@ jobs: name: Fyreplace.libre.aab path: app/build/outputs/bundle/libreRelease/app-libre-release.aab if-no-files-found: error + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'gradle' + + - name: Run tests + run: ./gradlew test publish: name: Publish - needs: build + needs: + - build + - test runs-on: ubuntu-latest environment: google-play-store steps: diff --git a/app/src/test/kotlin/app/fyreplace/fyreplace/test/navigation/DestinationTests.kt b/app/src/test/kotlin/app/fyreplace/fyreplace/test/navigation/DestinationTests.kt index c26ca0a7..48c6b187 100644 --- a/app/src/test/kotlin/app/fyreplace/fyreplace/test/navigation/DestinationTests.kt +++ b/app/src/test/kotlin/app/fyreplace/fyreplace/test/navigation/DestinationTests.kt @@ -2,12 +2,11 @@ package app.fyreplace.fyreplace.test.navigation import app.fyreplace.fyreplace.ui.views.navigation.Destination import org.junit.Assert.assertNotEquals -import org.junit.Assert.assertTrue import org.junit.Test class DestinationTests { @Test - fun testDestinationsAreUnique() { + fun `Destinations are unique`() { for (first in Destination.entries) { for (second in Destination.entries.filterNot { it == first }) { assertNotEquals(first.route, second.route) @@ -20,12 +19,7 @@ class DestinationTests { } @Test - fun testEssentialsAreFewer() { - assertTrue(Destination.Set.topLevel(flatten = false).size < Destination.Set.topLevel(flatten = true).size) - } - - @Test - fun testDestinationsDoNotLoop() { + fun `Destinations do not loop`() { for (destination in Destination.entries) { assertNotEquals(destination, destination.parent) assertNotEquals(destination, destination.parent?.parent)