Skip to content

Testing Assertions not works in laravel pest. #749

@carlosvaldesweb

Description

@carlosvaldesweb

I trying the tests in documentation, but assertions does not works.

use Prism\Prism\Enums\FinishReason;
use Prism\Prism\Facades\Prism;
use Prism\Prism\Testing\TextResponseFake;
use Prism\Prism\ValueObjects\Usage;

it('stores a custom prompt and saves the output text and credits used', function () {
    $fakeResponse = TextResponseFake::make()
        ->withText('This is my mobile device and I adore it.')
        ->withUsage(new Usage(10, 20));

    $fake = Prism::fake([$fakeResponse]);

    $text = Prism::text()
        ->using('anthropic', 'claude-3-sonnet')
        ->withPrompt('What is the meaning of life?')
        ->asStream();

    $fake->assertCallCount(1);

    $fake->assertRequest(function ($requests) {
        dd($requests);
    });

});
Tests\Feature\V1\CustomPromptTest > it stores a custom prompt and saves the output text and credits used                                                      
  Expected 1 calls, got 0
Failed asserting that 0 is identical to 1.

dd($requests); Return null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions