Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation Test Case For Show as Button Parameter #783

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)));
});
Loading