Fix tests still passing the word match bool

Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
This commit is contained in:
Nicolas Werner 2022-07-04 22:53:24 +02:00
parent f4f9851edd
commit bc20ad5cf1
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_eventmatch_type_condition() { fun test_eventmatch_type_condition() {
val condition = EventMatchCondition("type", "m.room.message", false) val condition = EventMatchCondition("type", "m.room.message")
val simpleTextEvent = createSimpleTextEvent("Yo wtf?") val simpleTextEvent = createSimpleTextEvent("Yo wtf?")
@ -72,7 +72,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_eventmatch_path_condition() { fun test_eventmatch_path_condition() {
val condition = EventMatchCondition("content.msgtype", "m.text", false) val condition = EventMatchCondition("content.msgtype", "m.text")
val simpleTextEvent = createSimpleTextEvent("Yo wtf?") val simpleTextEvent = createSimpleTextEvent("Yo wtf?")
@ -89,13 +89,13 @@ class PushRulesConditionTest : MatrixTest {
).toContent(), ).toContent(),
originServerTs = 0 originServerTs = 0
).apply { ).apply {
assert(EventMatchCondition("content.membership", "invite", false).isSatisfied(this)) assert(EventMatchCondition("content.membership", "invite").isSatisfied(this))
} }
} }
@Test @Test
fun test_eventmatch_cake_condition() { fun test_eventmatch_cake_condition() {
val condition = EventMatchCondition("content.body", "cake", false) val condition = EventMatchCondition("content.body", "cake")
assert(condition.isSatisfied(createSimpleTextEvent("How was the cake?"))) assert(condition.isSatisfied(createSimpleTextEvent("How was the cake?")))
assertFalse(condition.isSatisfied(createSimpleTextEvent("Howwasthecake?"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("Howwasthecake?")))
@ -103,7 +103,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_eventmatch_cakelie_condition() { fun test_eventmatch_cakelie_condition() {
val condition = EventMatchCondition("content.body", "cake*lie", false) val condition = EventMatchCondition("content.body", "cake*lie")
assert(condition.isSatisfied(createSimpleTextEvent("How was the cakeisalie?"))) assert(condition.isSatisfied(createSimpleTextEvent("How was the cakeisalie?")))
assertFalse(condition.isSatisfied(createSimpleTextEvent("How was the notcakeisalie?"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("How was the notcakeisalie?")))
@ -111,7 +111,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_eventmatch_words_only_condition() { fun test_eventmatch_words_only_condition() {
val condition = EventMatchCondition("content.body", "ben", true) val condition = EventMatchCondition("content.body", "ben")
assertFalse(condition.isSatisfied(createSimpleTextEvent("benoit"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("benoit")))
assertFalse(condition.isSatisfied(createSimpleTextEvent("Hello benoit"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("Hello benoit")))
@ -127,7 +127,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_eventmatch_at_room_condition() { fun test_eventmatch_at_room_condition() {
val condition = EventMatchCondition("content.body", "@room", true) val condition = EventMatchCondition("content.body", "@room")
assertFalse(condition.isSatisfied(createSimpleTextEvent("@roomba"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("@roomba")))
assertFalse(condition.isSatisfied(createSimpleTextEvent("room benoit"))) assertFalse(condition.isSatisfied(createSimpleTextEvent("room benoit")))
@ -142,7 +142,7 @@ class PushRulesConditionTest : MatrixTest {
@Test @Test
fun test_notice_condition() { fun test_notice_condition() {
val conditionEqual = EventMatchCondition("content.msgtype", "m.notice", false) val conditionEqual = EventMatchCondition("content.msgtype", "m.notice")
Event( Event(
type = "m.room.message", type = "m.room.message",