fix discriminante system_role / job_title
Build and Release FLUX (Multi-Platform) / build-windows (push) Canceled after 26s
Build and Release FLUX (Multi-Platform) / build-macos (push) Canceled after 0s
Build and Release FLUX (Multi-Platform) / build-web (push) Canceled after 31s
Build and Release FLUX (Multi-Platform) / build-linux (push) Canceled after 30s

This commit is contained in:
brontomark committed 2026-10-09 15:59:47 +02:00
1 parent 5e505d96b3
commit addb06a61a
4 files changed
+62 -35

No files matched your search

@@ -123,45 +123,54 @@ void main() {
});
});
group('StaffMemberModel.isExcludedFromRicontattiFocus', () {
test('excludes manager and tester by qualification jobTitle', () {
group('StaffMemberModel jobTitle discriminants', () {
test('canViewRicontattiFocus identifies Manager and Titolare by jobTitle', () {
final manager = StaffMemberModel.empty().copyWith(jobTitle: 'Manager');
final titolare = StaffMemberModel.empty().copyWith(jobTitle: 'Titolare');
final storeManager = StaffMemberModel.empty().copyWith(jobTitle: 'Store Manager');
final tester = StaffMemberModel.empty().copyWith(jobTitle: 'Tester');
final betaTester = StaffMemberModel.empty().copyWith(jobTitle: 'BETA TESTER');
expect(manager.isExcludedFromRicontattiFocus, isTrue);
expect(storeManager.isExcludedFromRicontattiFocus, isTrue);
expect(tester.isExcludedFromRicontattiFocus, isTrue);
expect(betaTester.isExcludedFromRicontattiFocus, isTrue);
});
test('excludes manager by systemRole and inactive members', () {
final roleManager = StaffMemberModel.empty().copyWith(
jobTitle: 'Addetto',
systemRole: SystemRole.manager,
final addetto = StaffMemberModel.empty().copyWith(
jobTitle: 'Addetto Vendite',
systemRole: SystemRole.user,
);
final roleAdmin = StaffMemberModel.empty().copyWith(
jobTitle: 'Addetto',
final admin = StaffMemberModel.empty().copyWith(
jobTitle: 'Tecnico',
systemRole: SystemRole.admin,
);
expect(manager.canViewRicontattiFocus, isTrue);
expect(titolare.canViewRicontattiFocus, isTrue);
expect(storeManager.canViewRicontattiFocus, isTrue);
expect(addetto.canViewRicontattiFocus, isFalse);
expect(admin.canViewRicontattiFocus, isTrue);
});
test('excludes Manager, Titolare, Tester from controlled staff', () {
final manager = StaffMemberModel.empty().copyWith(jobTitle: 'Manager');
final titolare = StaffMemberModel.empty().copyWith(jobTitle: 'Titolare');
final tester = StaffMemberModel.empty().copyWith(jobTitle: 'Tester');
final betaTester = StaffMemberModel.empty().copyWith(jobTitle: 'BETA TESTER');
final inactive = StaffMemberModel.empty().copyWith(
jobTitle: 'Addetto',
isActive: false,
);
expect(roleManager.isExcludedFromRicontattiFocus, isTrue);
expect(roleAdmin.isExcludedFromRicontattiFocus, isTrue);
expect(inactive.isExcludedFromRicontattiFocus, isTrue);
expect(manager.isExcludedFromControlledStaff, isTrue);
expect(titolare.isExcludedFromControlledStaff, isTrue);
expect(tester.isExcludedFromControlledStaff, isTrue);
expect(betaTester.isExcludedFromControlledStaff, isTrue);
expect(inactive.isExcludedFromControlledStaff, isTrue);
});
test('includes standard active addetti', () {
final addetto = StaffMemberModel.empty().copyWith(
test('addetto with systemRole manager is still controlled staff', () {
// systemRole indica permessi app, jobTitle indica il ruolo operativo in negozio
final addettoWithAdminPerms = StaffMemberModel.empty().copyWith(
jobTitle: 'Addetto Vendite',
systemRole: SystemRole.user,
systemRole: SystemRole.manager,
isActive: true,
);
expect(addetto.isExcludedFromRicontattiFocus, isFalse);
expect(addettoWithAdminPerms.isExcludedFromControlledStaff, isFalse);
expect(addettoWithAdminPerms.isManagerOrTitolare, isFalse);
expect(addettoWithAdminPerms.canViewRicontattiFocus, isFalse);
});
});
}