-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
inngest-core/src/test/kotlin/com/inngest/EnvironmentTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.inngest | ||
|
||
import kotlin.test.* | ||
|
||
// NOTE: not sure how to test values using environment variables | ||
internal class EnvironmentTest { | ||
// AppId | ||
@Test | ||
fun testInngestAppIdWithoutServeId() { | ||
val clientId = "hello" | ||
assertEquals(clientId, Environment.inngestAppId(clientId)) | ||
} | ||
|
||
@Test | ||
fun testInngestAppIdWithServeId() { | ||
val clientId = "hello" | ||
val serveId = "world" | ||
assertEquals(serveId, Environment.inngestAppId(clientId, serveId)) | ||
} | ||
|
||
// EventKey | ||
@Test | ||
fun testInngestEventKeyWithKey() { | ||
val key = "event" | ||
assertEquals(key, Environment.inngestEventKey(key)) | ||
} | ||
|
||
@Test | ||
fun testInngestEventKeyWithoutKey() { | ||
assertEquals("", Environment.inngestEventKey()) | ||
} | ||
|
||
// @Test | ||
// fun testInngestEventKeyWithEnvVar() {} | ||
|
||
// Signing key | ||
@Test | ||
fun testInngestSigningKeyWithKey() { | ||
val key = "signing key" | ||
assertEquals(key, Environment.inngestSigningKey(InngestEnv.Dev, key)) | ||
} | ||
|
||
@Test | ||
fun testInngestSigningKeyWithoutKeyDev() { | ||
assertEquals("test", Environment.inngestSigningKey(InngestEnv.Dev)) | ||
} | ||
|
||
// @Test | ||
// fun testInngestSigningKeyWithEnvVarProd() {} | ||
|
||
@Test | ||
fun testInngestSigningKeyWithoutKeyOrEnvVarProd() { | ||
assertFails( | ||
"signing key is required", | ||
{ Environment.inngestSigningKey(InngestEnv.Prod) }, | ||
) | ||
} | ||
} |