Skip to content

Commit

Permalink
#2 add MainKtTest
Browse files Browse the repository at this point in the history
  • Loading branch information
akryvtsun committed Nov 26, 2024
1 parent 9fac9ed commit 87cf092
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/GoogleSheetSupplier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GoogleSheetSupplier(

override fun get(): List<Postcrosser> {
// Authenticate using the service account
val textCredential = System.getProperty("GOOGLE_SHEETS_CRED")
val textCredential = System.getenv("GOOGLE_SHEETS_CRED")
val credential = GoogleCredential.fromStream(stringToInputStream(textCredential))
.createScoped(listOf("https://www.googleapis.com/auth/spreadsheets.readonly"))

Expand Down
19 changes: 19 additions & 0 deletions src/test/kotlin/MainKtTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import com.akryvtsun.isToday
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import java.time.LocalDate

class MainKtTest {

@Test
fun `should be equal to todays date`() {
val today = LocalDate.now()
assertThat(isToday(today)).isTrue()
}

@Test
fun `shouldn't be equal to todays date`() {
val tomorrow = LocalDate.now().plusDays(1)
assertThat(isToday(tomorrow)).isFalse()
}
}

0 comments on commit 87cf092

Please sign in to comment.