Skip to content

Commit

Permalink
Validation Test Case For Show as Button Parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kishore7snehil committed Nov 15, 2024
1 parent e7d9916 commit a9bc855
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Unit/API/Management/OrganizationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,3 +521,36 @@
$query = $this->api->getRequestQuery(null);
expect($query)->toContain('grant_ids=' . rawurlencode($grantIds));
});

test('create() issues an appropriate request with show as button parameter in enabled connections', function(): void {
$mock = (object) [
'id' => uniqid(),
'name' => uniqid(),
'branding' => [
'logo_url' => uniqid(),
],
'metadata' => [
'test' => uniqid()
],
'body' => [
'enabled_connections' => [
'connection_id' => uniqid(),
'show_as_button' => true
]
]
];

$this->endpoint->create($mock->id, $mock->name, $mock->branding, $mock->metadata, $mock->body);

expect($this->api->getRequestMethod())->toEqual('POST');
expect($this->api->getRequestUrl())->toEndWith('/api/v2/organizations');

$body = $this->api->getRequestBody();

$this->assertArrayHasKey('enabled_connections', $body);
$this->assertArrayHasKey('show_as_button', $body['enabled_connections']);
expect($body['enabled_connections']['show_as_button'])->toEqual($mock->body['enabled_connections']['show_as_button']);

$body = $this->api->getRequestBodyAsString();
expect($body)->toEqual(json_encode(array_merge(['name' => $mock->id, 'display_name' => $mock->name, 'branding' => $mock->branding, 'metadata' => $mock->metadata], $mock->body)));
});

0 comments on commit a9bc855

Please sign in to comment.