Skip to content

Commit

Permalink
Improve assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbrooks committed Jun 2, 2021
1 parent f025250 commit 9b904f0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vgo/src/test/kotlin/com/jzbrooks/vgo/BaselineTests.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jzbrooks.vgo

import assertk.assertThat
import assertk.assertions.hasText
import assertk.assertions.isEqualTo
import assertk.assertions.isLessThanOrEqualTo
import org.junit.jupiter.params.ParameterizedTest
Expand Down Expand Up @@ -37,9 +38,9 @@ class BaselineTests {

Application().run(arguments)

val content = File(outputFilePath).readText()
val baselineContent = baselineAsset.toFile().readText()
assertThat(content).isEqualTo(baselineContent)
val content = File(outputFilePath)
val baselineContent = baselineAsset.toFile()
assertThat(content, "optimized asset").hasText(baselineContent.readText())
}

@ParameterizedTest
Expand All @@ -55,7 +56,7 @@ class BaselineTests {
val optimizedAssetSize = File(outputFilePath).length()
val baselineAssetSize = baselineAsset.toFile().length()

assertThat(optimizedAssetSize).isLessThanOrEqualTo(baselineAssetSize)
assertThat(optimizedAssetSize, "optimized size").isLessThanOrEqualTo(baselineAssetSize)
}

@ParameterizedTest
Expand All @@ -71,7 +72,7 @@ class BaselineTests {
val optimizedAssetSize = File(outputFilePath).length()
val unoptimizedAssetSize = unoptimizedAsset.toFile().length()

assertThat(optimizedAssetSize).isLessThanOrEqualTo(unoptimizedAssetSize)
assertThat(optimizedAssetSize, "optimized asset").isLessThanOrEqualTo(unoptimizedAssetSize)
}

companion object {
Expand Down

0 comments on commit 9b904f0

Please sign in to comment.