-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IHRDS 3171 tester user should be able to change override (#873)
* non test setting change should not care about last updated time * add test * update tests
- Loading branch information
Showing
2 changed files
with
48 additions
and
2 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
46 changes: 46 additions & 0 deletions
46
tests/src/test/scala/com/iheart/thomas/abtest/model/ModelSuite.scala
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,46 @@ | ||
package com.iheart.thomas | ||
package abtest | ||
package model | ||
|
||
import org.scalatest.funsuite.AnyFunSuiteLike | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import java.time.Instant | ||
|
||
class ModelSuite extends AnyFunSuiteLike with Matchers { | ||
|
||
val existingFeatureConfig: Feature = Feature( | ||
name = "test feature", | ||
overrides = Map( | ||
"user1" -> "control", | ||
"user2" -> "treatment" | ||
), | ||
lastUpdated = Some(Instant.EPOCH) | ||
) | ||
|
||
test("a new feature config with new override should not trigger nonTestSettingsChangedFrom") { | ||
val newConfig: Feature = Feature( | ||
name = "test feature", | ||
overrides = Map( | ||
"user1" -> "treatment", | ||
"user2" -> "control" | ||
), | ||
lastUpdated = None | ||
) | ||
existingFeatureConfig nonTestSettingsChangedFrom newConfig shouldBe false | ||
} | ||
|
||
test("a new feature config with new description should trigger nonTestSettingsChangedFrom") { | ||
val newConfig: Feature = Feature( | ||
name = "test feature", | ||
description = Some("test description"), | ||
overrides = Map( | ||
"user1" -> "control", | ||
"user2" -> "treatment" | ||
), | ||
lastUpdated = None | ||
) | ||
existingFeatureConfig nonTestSettingsChangedFrom newConfig shouldBe true | ||
} | ||
|
||
} |