test: update DatabaseSchemaTest and WipeLegacySongDataTest for new schema
This commit is contained in:
parent
bf153b2906
commit
2a02f65517
|
|
@ -6,8 +6,6 @@
|
||||||
use App\Models\Slide;
|
use App\Models\Slide;
|
||||||
use App\Models\Song;
|
use App\Models\Song;
|
||||||
use App\Models\SongArrangement;
|
use App\Models\SongArrangement;
|
||||||
use App\Models\SongArrangementGroup;
|
|
||||||
use App\Models\SongGroup;
|
|
||||||
use App\Models\SongSlide;
|
use App\Models\SongSlide;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
@ -26,13 +24,18 @@
|
||||||
'failed_jobs',
|
'failed_jobs',
|
||||||
'services',
|
'services',
|
||||||
'songs',
|
'songs',
|
||||||
'song_groups',
|
'labels',
|
||||||
'song_slides',
|
'song_slides',
|
||||||
'song_arrangements',
|
'song_arrangements',
|
||||||
'song_arrangement_groups',
|
'song_arrangement_labels',
|
||||||
'service_songs',
|
'service_songs',
|
||||||
'slides',
|
'slides',
|
||||||
'cts_sync_log',
|
'cts_sync_log',
|
||||||
|
'macros',
|
||||||
|
'macro_collections',
|
||||||
|
'macro_assignments',
|
||||||
|
'service_macro_overrides',
|
||||||
|
'service_macro_assignments',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($expectedTables as $table) {
|
foreach ($expectedTables as $table) {
|
||||||
|
|
@ -40,23 +43,24 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('dropped tables no longer exist', function () {
|
||||||
|
expect(Schema::hasTable('song_groups'))->toBeFalse();
|
||||||
|
expect(Schema::hasTable('song_arrangement_groups'))->toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
test('all factories create valid records', function () {
|
test('all factories create valid records', function () {
|
||||||
Service::factory()->create();
|
Service::factory()->create();
|
||||||
Song::factory()->create();
|
Song::factory()->create();
|
||||||
SongGroup::factory()->create();
|
|
||||||
SongSlide::factory()->create();
|
SongSlide::factory()->create();
|
||||||
SongArrangement::factory()->create();
|
SongArrangement::factory()->create();
|
||||||
SongArrangementGroup::factory()->create();
|
|
||||||
ServiceSong::factory()->create();
|
ServiceSong::factory()->create();
|
||||||
Slide::factory()->create();
|
Slide::factory()->create();
|
||||||
CtsSyncLog::factory()->create();
|
CtsSyncLog::factory()->create();
|
||||||
|
|
||||||
expect(Service::count())->toBeGreaterThan(0)
|
expect(Service::count())->toBeGreaterThan(0)
|
||||||
->and(Song::count())->toBeGreaterThan(0)
|
->and(Song::count())->toBeGreaterThan(0)
|
||||||
->and(SongGroup::count())->toBeGreaterThan(0)
|
|
||||||
->and(SongSlide::count())->toBeGreaterThan(0)
|
->and(SongSlide::count())->toBeGreaterThan(0)
|
||||||
->and(SongArrangement::count())->toBeGreaterThan(0)
|
->and(SongArrangement::count())->toBeGreaterThan(0)
|
||||||
->and(SongArrangementGroup::count())->toBeGreaterThan(0)
|
|
||||||
->and(ServiceSong::count())->toBeGreaterThan(0)
|
->and(ServiceSong::count())->toBeGreaterThan(0)
|
||||||
->and(Slide::count())->toBeGreaterThan(0)
|
->and(Slide::count())->toBeGreaterThan(0)
|
||||||
->and(CtsSyncLog::count())->toBeGreaterThan(0);
|
->and(CtsSyncLog::count())->toBeGreaterThan(0);
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,9 @@
|
||||||
test('wipe migration is no-op on fresh database', function () {
|
test('wipe migration is no-op on fresh database', function () {
|
||||||
expect(DB::table('songs')->count())->toBe(0);
|
expect(DB::table('songs')->count())->toBe(0);
|
||||||
expect(Schema::hasTable('songs'))->toBeTrue();
|
expect(Schema::hasTable('songs'))->toBeTrue();
|
||||||
expect(Schema::hasTable('song_groups'))->toBeTrue();
|
expect(Schema::hasTable('song_groups'))->toBeFalse();
|
||||||
expect(DB::table('song_groups')->count())->toBe(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('wipe migration guard: song_groups exists but is empty after fresh install', function () {
|
test('wipe migration guard: song_groups does not exist after schema refactor', function () {
|
||||||
expect(Schema::hasTable('song_groups'))->toBeTrue();
|
expect(Schema::hasTable('song_groups'))->toBeFalse();
|
||||||
expect(DB::table('song_groups')->count())->toBe(0);
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue