mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-27 15:28:18 +08:00
Fix tests still passing the word match bool
Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
This commit is contained in:
parent
f4f9851edd
commit
bc20ad5cf1
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user