openai-async/t/02-create-client.t
Ryan Voots 2112424a80
Some checks failed
ci/woodpecker/push/author-tests Pipeline failed
brane fart here?
2023-11-22 17:40:20 -05:00

40 lines
No EOL
891 B
Perl

use strict;
use warnings;
use Test2::V0;
use OpenAIAsync::Client;
BEGIN {
$ENV{OPENAI_API_KEY}="12345" unless $ENV{OPENAI_API_KEY}eq"12345";
}
ok(lives {
my $client = OpenAIAsync::Client->new();
isa_ok($client, "OpenAIAsync::Client");
}, "basic client creation");
my $exp = dies {
my $client = OpenAIAsync::Client->new(bad_option_doesnt_exist => 1);
};
ok($exp, "Unknown option kills creation");
like($exp, qr/Unrecognised parameters for OpenAIAsync::Client constructor: 'bad_option_doesnt_exist' at/, "exception text for unknonwn option");
ok lives {
my $client = OpenAIAsync::Client->new(http_other_options => {});
isa_ok($client, "OpenAIAsync::Client");
}, "set http options";
ok lives {
my $client = OpenAIAsync::Client->new(io_async_notifier_params=>{});
isa_ok($client, "OpenAIAsync::Client");
}, "Can give io async notifier options";
done_testing();