From 47ea8699d1efb999df3e724478b5f9226f4e3358 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 7 Jan 2026 18:05:33 +0530 Subject: [PATCH] add: tests. --- tests/e2e/Services/GraphQL/StorageServerTest.php | 10 ++++++++++ tests/e2e/Services/Storage/StorageCustomServerTest.php | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/e2e/Services/GraphQL/StorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php index f54b4fa63a..2c648be99a 100644 --- a/tests/e2e/Services/GraphQL/StorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -105,6 +105,16 @@ class StorageServerTest extends Scope $buckets = $buckets['body']['data']['storageListBuckets']; $this->assertIsArray($buckets); + if (!empty($buckets['buckets'])) { + foreach ($buckets['buckets'] as $bucket) { + $this->assertArrayHasKey('totalSize', $bucket); + $this->assertIsInt($bucket['totalSize']); + + /* always 0 because the stats worker runs hourly! */ + $this->assertGreaterThanOrEqual(0, $bucket['totalSize']); + } + } + return $buckets; } diff --git a/tests/e2e/Services/Storage/StorageCustomServerTest.php b/tests/e2e/Services/Storage/StorageCustomServerTest.php index 5aa9010601..9b0473a352 100644 --- a/tests/e2e/Services/Storage/StorageCustomServerTest.php +++ b/tests/e2e/Services/Storage/StorageCustomServerTest.php @@ -96,6 +96,14 @@ class StorageCustomServerTest extends Scope $this->assertEquals($id, $response['body']['buckets'][0]['$id']); $this->assertEquals('Test Bucket', $response['body']['buckets'][0]['name']); + foreach ($response['body']['buckets'] as $bucket) { + $this->assertArrayHasKey('totalSize', $bucket); + $this->assertIsInt($bucket['totalSize']); + + /* always 0 because the stats worker runs hourly! */ + $this->assertGreaterThanOrEqual(0, $bucket['totalSize']); + } + $response = $this->client->call(Client::METHOD_GET, '/storage/buckets', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'],