From e3f60f4c78023858f8dabcad86bdb2518d229ca5 Mon Sep 17 00:00:00 2001 From: prateek banga Date: Thu, 23 Nov 2023 23:14:02 +0530 Subject: [PATCH] fix tests --- .env | 2 +- src/Appwrite/Utopia/Response/Model/Target.php | 6 +++++ tests/e2e/Services/GraphQL/Base.php | 27 ++++++++++++++++--- tests/e2e/Services/GraphQL/MessagingTest.php | 10 +++---- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/.env b/.env index 6ea21eed9d..f77083a035 100644 --- a/.env +++ b/.env @@ -87,7 +87,7 @@ _APP_LOGGING_PROVIDER= _APP_LOGGING_CONFIG= _APP_GRAPHQL_MAX_BATCH_SIZE=10 _APP_GRAPHQL_MAX_COMPLEXITY=250 -_APP_GRAPHQL_MAX_DEPTH=3 +_APP_GRAPHQL_MAX_DEPTH=4 _APP_DOCKER_HUB_USERNAME= _APP_DOCKER_HUB_PASSWORD= _APP_VCS_GITHUB_APP_NAME= diff --git a/src/Appwrite/Utopia/Response/Model/Target.php b/src/Appwrite/Utopia/Response/Model/Target.php index f6346f409a..a92d1b34ca 100644 --- a/src/Appwrite/Utopia/Response/Model/Target.php +++ b/src/Appwrite/Utopia/Response/Model/Target.php @@ -28,6 +28,12 @@ class Target extends Model 'default' => '', 'example' => self::TYPE_DATETIME_EXAMPLE, ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Target Name.', + 'default' => '', + 'example' => 'Aegon apple token', + ]) ->addRule('userId', [ 'type' => self::TYPE_STRING, 'description' => 'User ID.', diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 3777d67b73..6939e6a9b5 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -2044,9 +2044,16 @@ trait Base return 'mutation createSubscriber($subscriberId: String!, $targetId: String!, $topicId: String!) { messagingCreateSubscriber(subscriberId: $subscriberId, targetId: $targetId, topicId: $topicId) { _id - userId targetId topicId + userName + target { + _id + userId + name + providerType + identifier + } } }'; case self::$LIST_SUBSCRIBERS: @@ -2055,9 +2062,16 @@ trait Base total subscribers { _id - userId targetId topicId + userName + target { + _id + userId + name + providerType + identifier + } } } }'; @@ -2065,9 +2079,16 @@ trait Base return 'query getSubscriber($topicId: String!, $subscriberId: String!) { messagingGetSubscriber(topicId: $topicId, subscriberId: $subscriberId) { _id - userId targetId topicId + userName + target { + _id + userId + name + providerType + identifier + } } }'; case self::$DELETE_SUBSCRIBER: diff --git a/tests/e2e/Services/GraphQL/MessagingTest.php b/tests/e2e/Services/GraphQL/MessagingTest.php index e3ca99f2ac..d1a084cfc1 100644 --- a/tests/e2e/Services/GraphQL/MessagingTest.php +++ b/tests/e2e/Services/GraphQL/MessagingTest.php @@ -430,7 +430,7 @@ class MessagingTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals($response['body']['data']['messagingCreateSubscriber']['topicId'], $topicId); $this->assertEquals($response['body']['data']['messagingCreateSubscriber']['targetId'], $targetId); - $this->assertEquals($response['body']['data']['messagingCreateSubscriber']['userId'], $userId); + $this->assertEquals($response['body']['data']['messagingCreateSubscriber']['target']['userId'], $userId); return $response['body']['data']['messagingCreateSubscriber']; } @@ -454,9 +454,9 @@ class MessagingTest extends Scope ]), $graphQLPayload); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals($response['body']['data']['messagingListSubscribers']['subscribers'][0]['topicId'], $subscriber['topicId']); - $this->assertEquals($response['body']['data']['messagingListSubscribers']['subscribers'][0]['targetId'], $subscriber['targetId']); - $this->assertEquals($response['body']['data']['messagingListSubscribers']['subscribers'][0]['userId'], $subscriber['userId']); + $this->assertEquals($subscriber['topicId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['topicId']); + $this->assertEquals($subscriber['targetId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['targetId']); + $this->assertEquals($subscriber['target']['userId'], $response['body']['data']['messagingListSubscribers']['subscribers'][0]['target']['userId']); $this->assertEquals(1, \count($response['body']['data']['messagingListSubscribers']['subscribers'])); } @@ -487,7 +487,7 @@ class MessagingTest extends Scope $this->assertEquals($subscriberId, $response['body']['data']['messagingGetSubscriber']['_id']); $this->assertEquals($topicId, $response['body']['data']['messagingGetSubscriber']['topicId']); $this->assertEquals($subscriber['targetId'], $response['body']['data']['messagingGetSubscriber']['targetId']); - $this->assertEquals($subscriber['userId'], $response['body']['data']['messagingGetSubscriber']['userId']); + $this->assertEquals($subscriber['target']['userId'], $response['body']['data']['messagingGetSubscriber']['target']['userId']); } /**