test(avatars): narrow handle initials coverage to the handle claim

This commit is contained in:
harsh mahajan committed 2026-09-15 11:41:58 +05:30
1 parent f5aaba11df
commit 26f7c1bc76
2 files changed
+11 -20

No files matched your search

+11 -18
View File
@@ -537,27 +537,20 @@ trait AvatarsBase
$this->assertEquals(400, $response['headers']['status-code']);
}
public function testHandleInitials(): void
public function testGetInitialsHandle(): void
{
$signatures = [];
foreach (['@ItzNotABug', 'ItzNotABug'] as $name) {
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => $name,
'width' => 100,
'height' => 100,
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('image/png', $response['headers']['content-type']);
$response = $this->client->call(Client::METHOD_GET, '/avatars/initials', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
'name' => '@ItzNotABug',
'width' => 100,
'height' => 100,
]);
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertGreaterThan(1, $image->getImageColors());
$signatures[] = $image->getImageSignature();
}
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertSame($signatures[0], $signatures[1]);
$this->assertGreaterThan(1, $image->getImageColors(), 'A handle rendered a blank square.');
}
public function testInitialImage()
@@ -111,8 +111,6 @@ final class InitialsTest extends TestCase
yield 'padding and repeated spaces' => [' Walter White ', 'Walter White'];
yield 'username handle' => ['@ItzNotABug', 'ItzNotABug'];
yield 'padded handle with underscores' => [' @walter_white ', 'Walter White'];
yield 'unicode handle' => ['@élise', 'Élise'];
yield 'numeric handle' => ['@0', '0'];
}
#[DataProvider('provideEquivalentNames')]