Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions tests/Feature/Actions/FetchLlmUsageActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
config()->set('services.litellm.master_key', 'test-master-key');
});

/**
* @param array<int, array<string, mixed>> $data
* @return array<string, mixed>
*/
function llmPage(array $data, int $page, int $totalPages): array
{
return [
Expand Down Expand Up @@ -61,7 +65,8 @@ function llmPage(array $data, int $page, int $totalPages): array
it('walks every page and aggregates across them without loading the whole day at once', function () {
Http::fake([
'llm.codebar.net/spend/logs/v2*' => function (Request $request) {
$page = (int) data_get($request->data(), 'page');
$pageValue = data_get($request->data(), 'page');
$page = is_numeric($pageValue) ? (int) $pageValue : 1;

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

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

$qwen = $rows->first();
$qwen = $rows->firstOrFail();

expect($qwen['prompt_tokens'])->toBe(110)
->and($qwen['requests'])->toBe(2);
Expand Down
8 changes: 7 additions & 1 deletion tests/Feature/Components/IntroTabsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,13 @@ function introPanel(string $html, int $index): string
});

it('lets the panel height follow the content on mobile and freezes it on desktop', function () {
$intro = Str::after(file_get_contents(resource_path('css/app.css')), '.intro-tabs__panels');
$css = file_get_contents(resource_path('css/app.css'));

if ($css === false) {
throw new RuntimeException('Unable to read resources/css/app.css');
}

$intro = Str::after($css, '.intro-tabs__panels');

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