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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\GetQBCoreResourceList;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
test('GetQBCoreResourceList returns all resources', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request([]);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('QBCore Resources Directory');
|
||||
expect($content)->toContain('qb-ambulancejob');
|
||||
expect($content)->toContain('qb-adminmenu');
|
||||
expect($content)->toContain('qb-policejob');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList contains all 58 resources', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request([]);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
// Count resource names in the response
|
||||
$resources = [
|
||||
'qb-adminmenu', 'qb-ambulancejob', 'qb-apartments', 'qb-banking', 'qb-bankrobbery',
|
||||
'qb-busjob', 'qb-cityhall', 'qb-clothing', 'qb-crypto', 'qb-diving',
|
||||
'qb-doorlock', 'qb-drugs', 'qb-fitbit', 'qb-fuel', 'qb-garages',
|
||||
'qb-garbagejob', 'qb-hotdogjob', 'qb-houserobbery', 'qb-houses', 'qb-hud',
|
||||
'qb-input', 'qb-interior', 'qb-inventory', 'qb-jewelry', 'qb-lapraces',
|
||||
'qb-loading', 'qb-management', 'qb-mechanicjob', 'qb-menu', 'qb-minigames',
|
||||
'qb-multicharacter', 'qb-newsjob', 'qb-pawnshop', 'qb-phone', 'qb-policejob',
|
||||
'qb-prison', 'qb-radialmenu', 'qb-radio', 'qb-recyclejob', 'qb-scoreboard',
|
||||
'qb-scrapyard', 'qb-shops', 'qb-smallresources', 'qb-spawn', 'qb-storerobbery',
|
||||
'qb-streetraces', 'qb-taxijob', 'qb-towjob', 'qb-target', 'qb-truckerjob',
|
||||
'qb-truckrobbery', 'qb-vehiclekeys', 'qb-vehiclesales', 'qb-vehicleshop', 'qb-vineyard',
|
||||
'qb-weapons', 'qb-weathersync', 'qb-weed',
|
||||
];
|
||||
|
||||
foreach ($resources as $resource) {
|
||||
expect($content)->toContain($resource);
|
||||
}
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList filters by category - Jobs', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request(['category' => 'Jobs']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
// Should contain job resources
|
||||
expect($content)->toContain('qb-ambulancejob');
|
||||
expect($content)->toContain('qb-policejob');
|
||||
expect($content)->toContain('qb-mechanicjob');
|
||||
|
||||
// Should not contain non-job resources
|
||||
expect($content)->not->toContain('## Admin & Management');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList filters by category - Crime & Robberies', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request(['category' => 'Crime & Robberies']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('qb-bankrobbery');
|
||||
expect($content)->toContain('qb-drugs');
|
||||
expect($content)->toContain('qb-weed');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList filters by category - Admin & Management', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request(['category' => 'Admin & Management']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('qb-adminmenu');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList filters by category - UI & Interface', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request(['category' => 'UI & Interface']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('qb-hud');
|
||||
expect($content)->toContain('qb-menu');
|
||||
expect($content)->toContain('qb-target');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList filters by category - Housing & Interiors', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request(['category' => 'Housing & Interiors']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('qb-apartments');
|
||||
expect($content)->toContain('qb-houses');
|
||||
expect($content)->toContain('qb-interior');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList contains documentation links', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request([]);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('https://docs.qbcore.org/qbcore-documentation/qbcore-resources/');
|
||||
expect($content)->toContain('View Docs');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceList has grouped categories', function () {
|
||||
$tool = new GetQBCoreResourceList;
|
||||
$request = new Request([]);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('### Admin');
|
||||
expect($content)->toContain('### Jobs');
|
||||
expect($content)->toContain('### Crime');
|
||||
expect($content)->toContain('### Housing');
|
||||
expect($content)->toContain('### Vehicles');
|
||||
});
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
use App\Mcp\Tools\QBCore\GetQBCoreResourceReference;
|
||||
use Laravel\Mcp\Request;
|
||||
|
||||
test('GetQBCoreResourceReference returns ambulance job details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-ambulancejob']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Ambulance Job');
|
||||
expect($content)->toContain('Hospital Check-in System');
|
||||
expect($content)->toContain('/heal');
|
||||
expect($content)->toContain('ifaks');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns admin menu details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-adminmenu']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Admin Menu');
|
||||
expect($content)->toContain('/admin');
|
||||
expect($content)->toContain('/blips');
|
||||
expect($content)->toContain('Player Management');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns hud details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-hud']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('HUD');
|
||||
expect($content)->toContain('Health Display');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns inventory details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-inventory']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Inventory');
|
||||
expect($content)->toContain('Player Systems');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns phone details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-phone']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Phone');
|
||||
expect($content)->toContain('Messaging');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns police job details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-policejob']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Police Job');
|
||||
expect($content)->toContain('Dispatch System');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference includes documentation URL', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-adminmenu']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('https://docs.qbcore.org/qbcore-documentation/qbcore-resources/qb-adminmenu');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference not found returns helpful message', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-nonexistent']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('not found');
|
||||
expect($content)->toContain('GetQBCoreResourceList');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference handles case variations', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'QBCore-Ambulancejob']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Ambulance Job');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns garages details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-garages']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Garages');
|
||||
expect($content)->toContain('Transportation');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference returns shops details', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-shops']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('Shops');
|
||||
expect($content)->toContain('Commerce');
|
||||
});
|
||||
|
||||
test('GetQBCoreResourceReference includes categories', function () {
|
||||
$tool = new GetQBCoreResourceReference;
|
||||
$request = new Request(['resource_name' => 'qb-target']);
|
||||
|
||||
$response = $tool->handle($request);
|
||||
$content = (string) $response->content();
|
||||
|
||||
expect($content)->toContain('UI & Interface');
|
||||
expect($content)->toContain('Target System');
|
||||
});
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user