Skip to content

Commit

Permalink
fix: use only ubuntu for unit tests and don't drop 1 state in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash-Garg committed Mar 25, 2023
1 parent 31d391b commit 15debf8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/develop_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35.6.4
uses: tj-actions/changed-files@v35.7.6
with:
files: |
.github/workflows/develop_ci.yml
Expand All @@ -42,7 +42,7 @@ jobs:
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0

Expand All @@ -68,7 +68,7 @@ jobs:
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0

Expand Down Expand Up @@ -96,12 +96,12 @@ jobs:
needs: [ check-codestyle ]
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35.6.4
uses: tj-actions/changed-files@v35.7.6
with:
files: |
.github/workflows/pr_ci.yml
Expand All @@ -41,7 +41,7 @@ jobs:
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Set up JDK
Expand All @@ -63,7 +63,7 @@ jobs:
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Set up JDK
Expand All @@ -88,7 +88,7 @@ jobs:
if: needs.file-changes.outputs.any == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v3.3.0
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Set up JDK
Expand Down
8 changes: 3 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ android {
}

androidComponents {
beforeVariants { variant ->
when {
variant.name.contains("benchmark", ignoreCase = true) -> {
variant.enable = false
}
beforeVariants {
if (it.name.contains("benchmark", true)) {
it.enable = false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ class TorrentListAdapter @Inject constructor() :

private class TorrentComparator : DiffUtil.ItemCallback<Torrent>() {
override fun areItemsTheSame(oldItem: Torrent, newItem: Torrent): Boolean {
return oldItem == newItem
return oldItem.hash == newItem.hash
}

override fun areContentsTheSame(oldItem: Torrent, newItem: Torrent): Boolean {
return oldItem.hash == newItem.hash
return oldItem == newItem
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import dev.yashgarg.qbit.FakeClientManager
import dev.yashgarg.qbit.MainDispatcherRule
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertFalse
Expand Down Expand Up @@ -37,15 +36,15 @@ class QbitRepositoryTest {
fun checkAddTorrentSuccess() = runTest {
assertTrue(repository.addTorrentUrl(Constants.magnetUrl) is Ok)

val data = repository.observeMainData().drop(1).first()
val data = repository.observeMainData().first()
assertTrue(data.torrents.containsKey(Constants.magnetHash))
}

@Test
fun checkRemoveTorrentSuccess() = runTest {
assertTrue(repository.removeTorrents(listOf(Constants.magnetHash)) is Ok)

val data = repository.observeMainData().drop(1).first()
val data = repository.observeMainData().first()
assertFalse(data.torrents.containsKey(Constants.magnetHash))
}
}

0 comments on commit 15debf8

Please sign in to comment.