Skip to content
Snippets Groups Projects
Commit dc028e2f authored by Sebastian's avatar Sebastian Committed by Mikolai Gütschow
Browse files

Let CI run tests; add a test for the sake of having one

parent 75dda183
No related branches found
No related tags found
1 merge request!73Let CI run tests; add a test for the sake of having one
Pipeline #8795 passed
......@@ -12,13 +12,16 @@ workflow:
- if: '$CI_COMMIT_BRANCH'
- if: '$CI_COMMIT_TAG'
variables:
GIT_SUBMODULE_STRATEGY: recursive
test:
stage: test
before_script:
- set -e
- export GRADLE_USER_HOME=$PWD/.gradle
script:
- ./gradlew --no-daemon ktlintCheck
- ./gradlew --no-daemon :check
after_script:
# these file change every time and should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
......
package org.briarproject.briar.desktop.contact
import org.briarproject.bramble.api.UniqueId
import org.briarproject.bramble.api.contact.ContactId
import org.briarproject.bramble.api.identity.AuthorId
import kotlin.random.Random
import kotlin.test.Test
import kotlin.test.assertEquals
class ContactItemTest {
@Test
fun test() {
val random = Random(1)
val item = ContactItem(
idWrapper = RealContactIdWrapper(ContactId(random.nextInt())),
authorId = AuthorId(random.nextBytes(UniqueId.LENGTH)),
name = "Alice",
alias = null,
isConnected = false,
isEmpty = false,
unread = 10,
timestamp = random.nextLong()
)
assertEquals("Alice", item.displayName)
val updated = item.updateAlias("liz")
assertEquals("liz (Alice)", updated.displayName)
// old item did not get updated
assertEquals("Alice", item.displayName)
val reset = updated.updateAlias(null)
assertEquals("Alice", reset.displayName)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment