Skip to content

Commit bf3d1fa

Browse files
committed
minor #413 [Platform][OpenAI][Whisper] Refactor test (OskarStark)
This PR was squashed before being merged into the main branch. Discussion ---------- [Platform][OpenAI][Whisper] Refactor test | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT Commits ------- 4cf3e69 [Platform][OpenAI][Whisper] Refactor test
2 parents b2a1424 + 4cf3e69 commit bf3d1fa

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/platform/tests/Bridge/OpenAi/Whisper/ModelClientTest.php

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ final class ModelClientTest extends TestCase
2727
public function testItSupportsWhisperModel()
2828
{
2929
$client = new ModelClient(new MockHttpClient(), 'test-key');
30-
$model = new Whisper();
31-
32-
$this->assertTrue($client->supports($model));
30+
$this->assertTrue($client->supports(new Whisper()));
3331
}
3432

3533
public function testItUsesTranscriptionEndpointByDefault()
@@ -44,10 +42,7 @@ function ($method, $url): MockResponse {
4442
]);
4543

4644
$client = new ModelClient($httpClient, 'test-key');
47-
$model = new Whisper();
48-
$payload = ['file' => 'audio-data'];
49-
50-
$client->request($model, $payload);
45+
$client->request(new Whisper(), ['file' => 'audio-data']);
5146

5247
$this->assertSame(1, $httpClient->getRequestsCount());
5348
}
@@ -64,11 +59,7 @@ function ($method, $url): MockResponse {
6459
]);
6560

6661
$client = new ModelClient($httpClient, 'test-key');
67-
$model = new Whisper();
68-
$payload = ['file' => 'audio-data'];
69-
$options = ['task' => Task::TRANSCRIPTION];
70-
71-
$client->request($model, $payload, $options);
62+
$client->request(new Whisper(), ['file' => 'audio-data'], ['task' => Task::TRANSCRIPTION]);
7263

7364
$this->assertSame(1, $httpClient->getRequestsCount());
7465
}
@@ -85,11 +76,7 @@ function ($method, $url): MockResponse {
8576
]);
8677

8778
$client = new ModelClient($httpClient, 'test-key');
88-
$model = new Whisper();
89-
$payload = ['file' => 'audio-data'];
90-
$options = ['task' => Task::TRANSLATION];
91-
92-
$client->request($model, $payload, $options);
79+
$client->request(new Whisper(), ['file' => 'audio-data'], ['task' => Task::TRANSLATION]);
9380

9481
$this->assertSame(1, $httpClient->getRequestsCount());
9582
}

0 commit comments

Comments
 (0)