1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

Fix GraphQL test relying on creating session when one exists

This commit is contained in:
Jake Barnby 2024-02-21 18:50:28 +13:00
parent 607ba5b32f
commit 353069bc1f
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -281,19 +281,22 @@ class BatchTest extends Scope
public function testQueryBatchedMutations()
{
$projectId = $this->getProject()['$id'];
$email = 'tester' . \uniqid() . '@example.com';
$email1 = 'tester' . \uniqid() . '@example.com';
$email2 = 'tester' . \uniqid() . '@example.com';
$graphQLPayload = [
'query' => 'mutation CreateAndLogin($userId: String!, $email: String!, $password: String!, $name: String) {
accountCreate(userId: $userId, email: $email, password: $password, name: $name) {
name
'query' => 'mutation CreateAndLogin($user1Id: String!, $user2Id: String!, $email1: String!, $email2: String!, $password: String!, $name: String) {
account1: accountCreate(userId: $user1Id, email: $email1, password: $password, name: $name) {
email
}
accountCreateEmailPasswordSession(email: $email, password: $password) {
expire
account2: accountCreate(userId: $user2Id, email: $email2, password: $password, name: $name) {
email
}
}',
'variables' => [
'userId' => ID::unique(),
'email' => $email,
'user1Id' => ID::unique(),
'user2Id' => ID::unique(),
'email1' => $email1,
'email2' => $email2,
'password' => 'password',
'name' => 'Tester',
],
@ -304,12 +307,12 @@ class BatchTest extends Scope
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
$this->assertIsArray($response['body']['data']);
$this->assertArrayNotHasKey('errors', $response['body']);
$this->assertArrayHasKey('accountCreate', $response['body']['data']);
$this->assertArrayHasKey('accountCreateEmailPasswordSession', $response['body']['data']);
$this->assertEquals('Tester', $response['body']['data']['accountCreate']['name']);
$this->assertArrayHasKey('account1', $response['body']['data']);
$this->assertArrayHasKey('account2', $response['body']['data']);
$this->assertEquals($email1, $response['body']['data']['account1']['email']);
$this->assertEquals($email2, $response['body']['data']['account2']['email']);
}
public function testQueryBatchedMutationsOfSameType()