manager = new AltumManager([ 'analytics' => ['url' => 'https://analytics.test', 'admin_key' => 'akey'], 'biolinks' => ['url' => 'https://bio.test', 'admin_key' => 'bkey'], 'pusher' => ['url' => 'https://push.test', 'admin_key' => 'pkey'], 'socialproof' => ['url' => 'https://trust.test', 'admin_key' => 'skey'], ]); }); it('creates analytics client', function () { expect($this->manager->analytics())->toBeInstanceOf(AnalyticsClient::class); }); it('creates biolinks client', function () { expect($this->manager->biolinks())->toBeInstanceOf(BiolinksClient::class); }); it('creates pusher client', function () { expect($this->manager->pusher())->toBeInstanceOf(PusherClient::class); }); it('creates socialproof client', function () { expect($this->manager->socialproof())->toBeInstanceOf(SocialproofClient::class); }); it('passes user API key to client', function () { $client = $this->manager->analytics('my-user-key'); \Illuminate\Support\Facades\Http::fake(['*' => \Illuminate\Support\Facades\Http::response([], 200)]); $client->user(); })->throwsNoExceptions(); it('throws on unconfigured product', function () { $mgr = new AltumManager([]); $mgr->analytics(); })->throws(\RuntimeException::class, 'not configured');