create(); SchoolEmailDomain::create([ 'domain' => 'test.com', 'school_id' => $school->id, ]); $lastLog = AuditLogEntry::latest()->first(); expect($lastLog->message)->toEqual('Added the email domain test.com to school '.$school->name); }); it('logs when a school email domain is deleted', function () { $domain = SchoolEmailDomain::factory()->create(); $domain->delete(); $lastLog = AuditLogEntry::orderBy('id', 'desc')->first(); expect($lastLog->message)->toEqual('Removed the email domain '.$domain->domain.' from school '.$domain->school->name); });