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,54 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\MySQL\GetCOXEventReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get cox event reference returns response with content', function () {
|
||||
$tool = new GetCOXEventReference;
|
||||
$request = new Request(['event_name' => 'coxMySQL:connected']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox event reference handles unknown event', function () {
|
||||
$tool = new GetCOXEventReference;
|
||||
$request = new Request(['event_name' => 'NonExistentCOXEvent123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found') || expect($content)->toContain('COX event');
|
||||
});
|
||||
|
||||
it('get cox event reference filters by type', function () {
|
||||
$tool = new GetCOXEventReference;
|
||||
$request = new Request(['event_type' => 'connection']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox event reference lists all events', function () {
|
||||
$tool = new GetCOXEventReference;
|
||||
$request = new Request(['event_type' => 'all']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox event reference supports query events', function () {
|
||||
$tool = new GetCOXEventReference;
|
||||
$request = new Request(['event_name' => 'coxMySQL:queryCompleted']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\MySQL\GetCOXFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get cox function returns response with content', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'MySQL.query']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox function handles unknown function', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found') || expect($content)->toContain('COX');
|
||||
});
|
||||
|
||||
it('get cox function works with insert method', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'MySQL.insert']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox function supports javascript examples', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'MySQL.query', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get cox function works with transaction methods', function () {
|
||||
$tool = new GetCOXFunction;
|
||||
$request = new Request(['function_name' => 'MySQL.transaction']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\Inventory\Client\GetInventoryClientFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get inventory client function returns response with content', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'openInventory']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function handles unknown function', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
});
|
||||
|
||||
it('get inventory client function works with SearchPlayer', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'SearchPlayer']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function works with useItem', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'useItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function supports javascript examples', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'GetCurrentWeapon', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory client function works with getCurrentWeight', function () {
|
||||
$tool = new GetInventoryClientFunction;
|
||||
$request = new Request(['function_name' => 'getCurrentWeight']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\COX\Inventory\Server\GetInventoryServerFunction;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
it('get inventory server function returns response with content', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'AddItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function handles unknown function', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'NonExistentFunction123']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
});
|
||||
|
||||
it('get inventory server function works with RemoveItem', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'RemoveItem']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function works with RegisterStash', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'RegisterStash']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function supports javascript examples', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'GetItem', 'language' => 'js']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
|
||||
it('get inventory server function works with SetDurability', function () {
|
||||
$tool = new GetInventoryServerFunction;
|
||||
$request = new Request(['function_name' => 'SetDurability']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
|
||||
expect($response)->not()->toBeNull();
|
||||
expect($response->content())->not()->toBeNull();
|
||||
});
|
||||
Reference in new issue
Block a user