website refactor

This commit is contained in:
2026-01-16 18:21:06 +01:00
parent 2f53727702
commit 095885544b
146 changed files with 970 additions and 524 deletions

View File

@@ -1,5 +1,6 @@
import { AdminTrustReasonCode } from './AdminTrustReasonCode';
import { AdminTrustReasonCode, type AdminTrustReasonCodeValue } from './AdminTrustReasonCode';
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
import { describe, it, expect } from 'vitest';
describe('AdminTrustReasonCode', () => {
describe('create', () => {
@@ -71,7 +72,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_VOTE_OUTCOME_NEGATIVE',
];
voteCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isVoteOutcome()).toBe(true);
});
});
@@ -82,7 +83,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_REVERSAL_PENALTY',
];
nonVoteCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isVoteOutcome()).toBe(false);
});
});
@@ -97,7 +98,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_ABUSE_REPORT_PENALTY',
];
systemCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isSystemSignal()).toBe(true);
});
});
@@ -108,7 +109,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_VOTE_OUTCOME_NEGATIVE',
];
nonSystemCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isSystemSignal()).toBe(false);
});
});
@@ -122,7 +123,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_RULE_CLARITY_BONUS',
];
positiveCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isPositive()).toBe(true);
});
});
@@ -134,7 +135,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_ABUSE_REPORT_PENALTY',
];
nonPositiveCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isPositive()).toBe(false);
});
});
@@ -148,7 +149,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_ABUSE_REPORT_PENALTY',
];
negativeCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isNegative()).toBe(true);
});
});
@@ -160,7 +161,7 @@ describe('AdminTrustReasonCode', () => {
'ADMIN_ACTION_RULE_CLARITY_BONUS',
];
nonNegativeCodes.forEach(codeStr => {
const code = AdminTrustReasonCode.fromValue(codeStr as any);
const code = AdminTrustReasonCode.fromValue(codeStr as AdminTrustReasonCodeValue);
expect(code.isNegative()).toBe(false);
});
});

View File

@@ -1,5 +1,6 @@
import { DrivingReasonCode } from './DrivingReasonCode';
import { DrivingReasonCode, type DrivingReasonCodeValue } from './DrivingReasonCode';
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
import { describe, it, expect } from 'vitest';
describe('DrivingReasonCode', () => {
describe('create', () => {
@@ -77,7 +78,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_PACE_RELATIVE_GAIN',
];
performanceCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isPerformance()).toBe(true);
});
});
@@ -89,7 +90,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_SEASON_ATTENDANCE_BONUS',
];
nonPerformanceCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isPerformance()).toBe(false);
});
});
@@ -103,7 +104,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_PENALTY_INVOLVEMENT_PENALTY',
];
cleanDrivingCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isCleanDriving()).toBe(true);
});
});
@@ -115,7 +116,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_SEASON_ATTENDANCE_BONUS',
];
nonCleanDrivingCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isCleanDriving()).toBe(false);
});
});
@@ -131,7 +132,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_SEASON_ATTENDANCE_BONUS',
];
reliabilityCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isReliability()).toBe(true);
});
});
@@ -142,7 +143,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_INCIDENTS_PENALTY',
];
nonReliabilityCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isReliability()).toBe(false);
});
});
@@ -160,7 +161,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_AFK_PENALTY',
];
penaltyCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isPenalty()).toBe(true);
});
});
@@ -172,7 +173,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_SEASON_ATTENDANCE_BONUS',
];
nonPenaltyCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isPenalty()).toBe(false);
});
});
@@ -187,7 +188,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_PACE_RELATIVE_GAIN',
];
bonusCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isBonus()).toBe(true);
});
});
@@ -198,7 +199,7 @@ describe('DrivingReasonCode', () => {
'DRIVING_DNS_PENALTY',
];
nonBonusCodes.forEach(codeStr => {
const code = DrivingReasonCode.fromValue(codeStr as any);
const code = DrivingReasonCode.fromValue(codeStr as DrivingReasonCodeValue);
expect(code.isBonus()).toBe(false);
});
});