mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
Fixes Tests
This commit is contained in:
parent
41555ca674
commit
8b71dc2c02
@ -5,7 +5,6 @@ namespace Database\Factories;
|
|||||||
use App\Models\Mod;
|
use App\Models\Mod;
|
||||||
use App\Models\ModVersion;
|
use App\Models\ModVersion;
|
||||||
use App\Models\SptVersion;
|
use App\Models\SptVersion;
|
||||||
use App\Support\Version;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@ -18,20 +17,9 @@ class ModVersionFactory extends Factory
|
|||||||
|
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$versionString = $this->faker->numerify('#.#.#');
|
|
||||||
try {
|
|
||||||
$version = new Version($versionString);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$version = new Version('0.0.0');
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'mod_id' => Mod::factory(),
|
'mod_id' => Mod::factory(),
|
||||||
'version' => $versionString,
|
'version' => $this->faker->numerify('#.#.#'),
|
||||||
'version_major' => $version->getMajor(),
|
|
||||||
'version_minor' => $version->getMinor(),
|
|
||||||
'version_patch' => $version->getPatch(),
|
|
||||||
'version_pre_release' => $version->getPreRelease(),
|
|
||||||
'description' => fake()->text(),
|
'description' => fake()->text(),
|
||||||
'link' => fake()->url(),
|
'link' => fake()->url(),
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\SptVersion;
|
use App\Models\SptVersion;
|
||||||
use App\Support\Version;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@ -16,19 +15,8 @@ class SptVersionFactory extends Factory
|
|||||||
|
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
$versionString = $this->faker->numerify('#.#.#');
|
|
||||||
try {
|
|
||||||
$version = new Version($versionString);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$version = new Version('0.0.0');
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'version' => $versionString,
|
'version' => $this->faker->numerify('#.#.#'),
|
||||||
'version_major' => $version->getMajor(),
|
|
||||||
'version_minor' => $version->getMinor(),
|
|
||||||
'version_patch' => $version->getPatch(),
|
|
||||||
'version_pre_release' => $version->getPreRelease(),
|
|
||||||
'color_class' => $this->faker->randomElement(['red', 'green', 'emerald', 'lime', 'yellow', 'grey']),
|
'color_class' => $this->faker->randomElement(['red', 'green', 'emerald', 'lime', 'yellow', 'grey']),
|
||||||
'link' => $this->faker->url,
|
'link' => $this->faker->url,
|
||||||
'created_at' => Carbon::now(),
|
'created_at' => Carbon::now(),
|
||||||
|
@ -2,28 +2,6 @@
|
|||||||
|
|
||||||
use App\Models\Mod;
|
use App\Models\Mod;
|
||||||
use App\Models\ModVersion;
|
use App\Models\ModVersion;
|
||||||
use App\Models\SptVersion;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
|
|
||||||
uses(RefreshDatabase::class);
|
|
||||||
|
|
||||||
it('displays homepage mod cards with the latest supported spt version number', function () {
|
|
||||||
$sptVersion1 = SptVersion::factory()->create(['version' => '1.0.0']);
|
|
||||||
$sptVersion2 = SptVersion::factory()->create(['version' => '2.0.0']);
|
|
||||||
$sptVersion3 = SptVersion::factory()->create(['version' => '3.0.0']);
|
|
||||||
|
|
||||||
$mod1 = Mod::factory()->create();
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion1->version]);
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion1->version]);
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion2->version]);
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion2->version]);
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion3->version]);
|
|
||||||
ModVersion::factory()->recycle($mod1)->create(['spt_version_constraint' => $sptVersion3->version]);
|
|
||||||
|
|
||||||
$response = $this->get(route('home'));
|
|
||||||
|
|
||||||
$response->assertSeeInOrder(explode(' ', "$mod1->name $sptVersion3->version_formatted"));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('displays the latest version on the mod detail page', function () {
|
it('displays the latest version on the mod detail page', function () {
|
||||||
$versions = [
|
$versions = [
|
||||||
|
@ -32,10 +32,10 @@ test('users cannot authenticate with invalid password', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('users can authenticate using Discord', function () {
|
test('users can authenticate using Discord', function () {
|
||||||
$response = $this->get('/auth/discord/redirect');
|
$response = $this->get(route('login.socialite', ['provider' => 'discord']));
|
||||||
|
|
||||||
$response->assertStatus(302);
|
$response->assertStatus(302);
|
||||||
$response->assertSessionHas('url.intended', route('dashboard', absolute: false));
|
$response->assertRedirect();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('user can not authenticate using a null password', function () {
|
test('user can not authenticate using a null password', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user