Add feature tests for QBCore and FiveM tools
- Implement tests for GetInventoryClientFunction and GetInventoryServerFunction in the COX namespace. - Create tests for GenerateManifest and GenerateResourceBoilerplate in the FiveM namespace. - Add tests for event and native function references in the FiveM namespace. - Introduce tests for QBCore client and server event references, functions, and configurations. - Implement tests for shared data retrieval in QBCore. - Ensure all tests validate expected responses and handle edge cases.
This commit is contained in:
25 files changed
+1188
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\FiveM\Server\GetNativeServerFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('returns server native function info', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'TriggerClientEvent', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('TriggerClientEvent');
|
||||
});
|
||||
|
||||
it('returns not found for invalid function', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'InvalidServerFunction', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('not found');
|
||||
});
|
||||
|
||||
it('supports javascript examples for server natives', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'GetPlayerName', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
|
||||
it('handles case insensitive server function names', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => 'getplayername', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->toContain('GetPlayerName');
|
||||
});
|
||||
|
||||
it('lists all server functions when no name provided', function () {
|
||||
$tool = new GetNativeServerFunction;
|
||||
$request = new Request(['function_name' => '', 'language' => 'lua']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect((string) $response->content())->not()->toBeEmpty();
|
||||
});
|
||||
Reference in new issue
Block a user