From f02e087e30d3a27568765c1d3b3e0ac9d82aeab7 Mon Sep 17 00:00:00 2001 From: Matthias Oertel Date: Thu, 8 Aug 2019 14:11:22 +0200 Subject: [PATCH] add test case --- .../specs/SubscriptionFilterSpec.scala | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/server/servers/subscriptions/src/test/scala/com/prisma/subscriptions/specs/SubscriptionFilterSpec.scala b/server/servers/subscriptions/src/test/scala/com/prisma/subscriptions/specs/SubscriptionFilterSpec.scala index 8703e09e0b..1d43f49d03 100644 --- a/server/servers/subscriptions/src/test/scala/com/prisma/subscriptions/specs/SubscriptionFilterSpec.scala +++ b/server/servers/subscriptions/src/test/scala/com/prisma/subscriptions/specs/SubscriptionFilterSpec.scala @@ -104,6 +104,48 @@ class SubscriptionFilterSpec extends FlatSpec with Matchers with SubscriptionSpe } } + "this" should "work when using aliases" in { + testInitializedWebsocket(project) { wsClient => + wsClient.sendMessage( + startMessage( + id = "3", + query = """subscription { + | alias: todo{ + | mutation + | previousValues { + | id + | text + | status + | } + | } + |}""".stripMargin + ) + ) + + sleep(8000) + + val event = nodeEvent( + modelId = model.name, + changedFields = Seq("text"), + previousValues = s"""{"id":"$testNodeId", "text":"event1", "status": "Active", "tags":[]}""" + ) + + sssEventsTestKit.publish(Only(s"subscription:event:${project.id}:updateTodo"), event) + + wsClient.expectMessage( + dataMessage( + id = "3", + payload = s"""{ + | "alias":{ + | "mutation":"UPDATED", + | "previousValues":{"id":"$testNodeId", "text":"event1", "status":"Active"} + | } + |}""".stripMargin + ) + ) + } + } + "this" should "support scalar lists in previous values" ignore { testInitializedWebsocket(project) { wsClient => wsClient.sendMessage(