-
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: enabledFeatures on self-hosted instances & Sentry false positives (
- Loading branch information
Showing
5 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
39 changes: 39 additions & 0 deletions
39
ee/backend/tests/src/test/kotlin/io/tolgee/ee/unit/SelfHostedEePlanModelTest.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,39 @@ | ||
package io.tolgee.ee.unit | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import io.tolgee.constants.Feature | ||
import io.tolgee.hateoas.ee.PlanPricesModel | ||
import io.tolgee.hateoas.ee.SelfHostedEePlanModel | ||
import io.tolgee.testing.assert | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
|
||
@SpringBootTest | ||
class SelfHostedEePlanModelTest { | ||
@Autowired | ||
private lateinit var objectMapper: ObjectMapper | ||
|
||
@Test | ||
fun `parses plan response with unknown features`() { | ||
val parsed = | ||
objectMapper.readValue<SelfHostedEePlanModel>( | ||
""" | ||
{ | ||
"enabledFeatures": ["I've made this up", "ASSISTED_UPDATES"], | ||
"prices": $pricesJson, | ||
"free": false, | ||
"nonCommercial": false | ||
} | ||
""".trimIndent(), | ||
) | ||
|
||
parsed.enabledFeatures.toList().assert.containsExactly(Feature.ASSISTED_UPDATES) | ||
} | ||
|
||
val pricesJson: String | ||
get() { | ||
return objectMapper.writeValueAsString(PlanPricesModel()) | ||
} | ||
} |