Skip to content

Commit aa806ed

Browse files
authored
Merge pull request #95 from codebar-ag/feature-updates
Fix Larastan errors in test files from PR #94
2 parents 62458a9 + afc58cf commit aa806ed

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

tests/Feature/Actions/FetchLlmUsageActionTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
config()->set('services.litellm.master_key', 'test-master-key');
1414
});
1515

16+
/**
17+
* @param array<int, array<string, mixed>> $data
18+
* @return array<string, mixed>
19+
*/
1620
function llmPage(array $data, int $page, int $totalPages): array
1721
{
1822
return [
@@ -61,7 +65,8 @@ function llmPage(array $data, int $page, int $totalPages): array
6165
it('walks every page and aggregates across them without loading the whole day at once', function () {
6266
Http::fake([
6367
'llm.codebar.net/spend/logs/v2*' => function (Request $request) {
64-
$page = (int) data_get($request->data(), 'page');
68+
$pageValue = data_get($request->data(), 'page');
69+
$page = is_numeric($pageValue) ? (int) $pageValue : 1;
6570

6671
return match ($page) {
6772
1 => Http::response(llmPage([
@@ -79,7 +84,7 @@ function llmPage(array $data, int $page, int $totalPages): array
7984

8085
expect($rows)->toHaveCount(1);
8186

82-
$qwen = $rows->first();
87+
$qwen = $rows->firstOrFail();
8388

8489
expect($qwen['prompt_tokens'])->toBe(110)
8590
->and($qwen['requests'])->toBe(2);

tests/Feature/Components/IntroTabsTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@ function introPanel(string $html, int $index): string
185185
});
186186

187187
it('lets the panel height follow the content on mobile and freezes it on desktop', function () {
188-
$intro = Str::after(file_get_contents(resource_path('css/app.css')), '.intro-tabs__panels');
188+
$css = file_get_contents(resource_path('css/app.css'));
189+
190+
if ($css === false) {
191+
throw new RuntimeException('Unable to read resources/css/app.css');
192+
}
193+
194+
$intro = Str::after($css, '.intro-tabs__panels');
189195

190196
$mobile = Str::before($intro, '@media');
191197
$desktop = Str::after($intro, '@media (width >= 40rem)');

0 commit comments

Comments
 (0)