mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-13 06:47:46 -08:00
Scaffold tests
This commit is contained in:
parent
02f39472f9
commit
4354e126b1
|
@ -4,6 +4,7 @@ namespace Tests\Feature\Api\Assets;
|
||||||
|
|
||||||
use App\Events\CheckoutableCheckedIn;
|
use App\Events\CheckoutableCheckedIn;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
|
use App\Models\Location;
|
||||||
use App\Models\Statuslabel;
|
use App\Models\Statuslabel;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
|
@ -50,7 +51,7 @@ class AssetCheckinTest extends TestCase
|
||||||
$this->assertTrue($asset->assignedTo->is($user));
|
$this->assertTrue($asset->assignedTo->is($user));
|
||||||
|
|
||||||
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
->postJson(route('api.asset.checkin', $asset->id), [
|
->postJson(route('api.asset.checkin', $asset), [
|
||||||
'name' => 'Changed Name',
|
'name' => 'Changed Name',
|
||||||
'status_id' => $status->id,
|
'status_id' => $status->id,
|
||||||
])
|
])
|
||||||
|
@ -68,22 +69,54 @@ class AssetCheckinTest extends TestCase
|
||||||
$this->assertEquals($status->id, $asset->status_id);
|
$this->assertEquals($status->id, $asset->status_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLastCheckInFieldIsSetOnCheckin()
|
public function testLocationIsSetToRTDLocationByDefaultUponCheckin()
|
||||||
{
|
{
|
||||||
$admin = User::factory()->checkinAssets()->create();
|
$rtdLocation = Location::factory()->create();
|
||||||
$asset = Asset::factory()->assignedToUser()->create(['last_checkin' => null]);
|
$asset = Asset::factory()->assignedToUser()->create([
|
||||||
|
'location_id' => Location::factory()->create()->id,
|
||||||
|
'rtd_location_id' => $rtdLocation->id,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->actingAsForApi($admin)
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
->postJson(route('api.asset.checkin', $asset))
|
->postJson(route('api.asset.checkin', $asset->id));
|
||||||
->assertOk();
|
|
||||||
|
|
||||||
$this->assertNotNull(
|
$this->assertTrue($asset->refresh()->location()->is($rtdLocation));
|
||||||
$asset->fresh()->last_checkin,
|
}
|
||||||
'last_checkin field should be set on checkin'
|
|
||||||
);
|
public function testLocationCanBeSetUponCheckin()
|
||||||
|
{
|
||||||
|
$location = Location::factory()->create();
|
||||||
|
$asset = Asset::factory()->assignedToUser()->create();
|
||||||
|
|
||||||
|
$this->actingAsForApi(User::factory()->checkinAssets()->create())
|
||||||
|
->postJson(route('api.asset.checkin', $asset->id), [
|
||||||
|
'location_id' => $location->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertTrue($asset->refresh()->location()->is($location));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDefaultLocationCanBeUpdatedUponCheckin()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAssetsLicenseSeatsAreClearedUponCheckin()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testLegacyLocationValuesSetToZeroAreUpdated()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
|
public function testPendingCheckoutAcceptancesAreClearedUponCheckin()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete('Not currently in controller');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCheckinTimeAndActionLogNoteCanBeSet()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->markTestIncomplete();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue