22using Microsoft . EntityFrameworkCore ;
33using NSubstitute ;
44using RustPlusBot . Domain . Connections ;
5+ using RustPlusBot . Domain . Credentials ;
56using RustPlusBot . Domain . Entities ;
67using RustPlusBot . Domain . Events ;
78using RustPlusBot . Domain . Guilds ;
@@ -68,6 +69,14 @@ public async Task PurgeGuild_RemovesTargetGuildRows_AndLeavesOtherGuildIntact()
6869 {
6970 GuildId = 2 , Culture = "fr"
7071 } ) ;
72+ context . FcmRegistrations . Add ( new FcmRegistration
73+ {
74+ GuildId = 1 , OwnerUserId = 100 , ProtectedFcmCredentials = "x"
75+ } ) ;
76+ context . FcmRegistrations . Add ( new FcmRegistration
77+ {
78+ GuildId = 2 , OwnerUserId = 200 , ProtectedFcmCredentials = "y"
79+ } ) ;
7180 await context . SaveChangesAsync ( ) ;
7281
7382 var teardown = Substitute . For < IWorkspaceTeardownService > ( ) ;
@@ -82,10 +91,12 @@ public async Task PurgeGuild_RemovesTargetGuildRows_AndLeavesOtherGuildIntact()
8291 Assert . Empty ( await context . EventSubscriptions . Where ( e => e . GuildId == 1 ) . ToListAsync ( ) ) ;
8392 Assert . Empty ( await context . PairedEntities . Where ( p => p . GuildId == 1 ) . ToListAsync ( ) ) ;
8493 Assert . Empty ( await context . GuildSettings . Where ( g => g . GuildId == 1 ) . ToListAsync ( ) ) ;
94+ Assert . Empty ( await context . FcmRegistrations . Where ( f => f . GuildId == 1 ) . ToListAsync ( ) ) ;
8595
8696 // Guild 2 untouched.
8797 Assert . Single ( await context . RustServers . Where ( s => s . GuildId == 2 ) . ToListAsync ( ) ) ;
8898 Assert . Single ( await context . EventSubscriptions . Where ( e => e . GuildId == 2 ) . ToListAsync ( ) ) ;
8999 Assert . Single ( await context . GuildSettings . Where ( g => g . GuildId == 2 ) . ToListAsync ( ) ) ;
100+ Assert . Single ( await context . FcmRegistrations . Where ( f => f . GuildId == 2 ) . ToListAsync ( ) ) ;
90101 }
91102}
0 commit comments