Files
calendar/packages/features/flags/features.repository.mock.ts
T
98b6d63164 refactor: apply biome formatting to packages/features (#27844)
* refactor: apply biome formatting to packages/features (batch 1 - small subdirs)

Format small subdirectories in packages/features: di, flags, holidays, oauth,
settings, users, assignment-reason, selectedCalendar, hashedLink, host, form,
form-builder, availability, data-table, pbac, schedules, troubleshooter,
eventtypes, calendar-subscription, and root-level files.

Also includes straggler apps/web BookEventForm.tsx.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: apply biome formatting to packages/features (batch 2 - medium subdirs)

Format medium subdirectories in packages/features: auth, credentials,
calendars, routing-forms, routing-trace, attributes, watchlist, calAIPhone,
tasker, and webhooks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: apply biome formatting to packages/features (batch 3 - bookings + insights)

Format bookings and insights subdirectories in packages/features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: apply biome formatting to packages/features (batch 4 - ee)

Format packages/features/ee subdirectory covering billing, workflows,
organizations, teams, managed-event-types, round-robin, dsync,
integration-attribute-sync, and payments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: apply biome formatting to packages/features (batch 5 - booking-audit part 1)

Format booking-audit di, actions, common, dto, repository, and types
subdirectories in packages/features/booking-audit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: apply biome formatting to packages/features (batch 6 - booking-audit part 2)

Format booking-audit service subdirectory in packages/features/booking-audit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 15:47:14 +01:00

93 lines
2.6 KiB
TypeScript

import type { FeatureId, FeatureState } from "./config";
import type { IFeaturesRepository } from "./features.repository.interface";
export class MockFeaturesRepository implements IFeaturesRepository {
async checkIfUserHasFeature(_userId: number, slug: string) {
return slug === "mock-feature";
}
async getUserFeaturesStatus(_userId: number, slugs: string[]): Promise<Record<string, boolean>> {
return Object.fromEntries(slugs.map((slug) => [slug, slug === "mock-feature"]));
}
async checkIfUserHasFeatureNonHierarchical(_userId: number, slug: string) {
return slug === "mock-feature";
}
async checkIfTeamHasFeature(_teamId: number, slug: FeatureId) {
return slug === "mock-feature";
}
async checkIfFeatureIsEnabledGlobally(_slug: FeatureId) {
return true;
}
async getTeamsWithFeatureEnabled(_slug: FeatureId): Promise<number[]> {
return [];
}
async setUserFeatureState(
_input:
| {
userId: number;
featureId: FeatureId;
state: "enabled" | "disabled";
assignedBy: string;
}
| { userId: number; featureId: FeatureId; state: "inherit" }
): Promise<void> {
// Mock implementation - do nothing
}
async setTeamFeatureState(
_input:
| {
teamId: number;
featureId: FeatureId;
state: "enabled" | "disabled";
assignedBy: string;
}
| { teamId: number; featureId: FeatureId; state: "inherit" }
): Promise<void> {
// Mock implementation - do nothing
}
async getUserFeatureStates(_input: {
userId: number;
featureIds: FeatureId[];
}): Promise<Record<string, FeatureState>> {
// Mock implementation - return inherit for all features
const result: Record<string, FeatureState> = {};
for (const featureId of _input.featureIds) {
result[featureId] = "inherit";
}
return result;
}
async getTeamsFeatureStates(_input: {
teamIds: number[];
featureIds: FeatureId[];
}): Promise<Record<string, Record<number, FeatureState>>> {
// Mock implementation - return empty (all teams inherit)
return {};
}
async getUserAutoOptIn(_userId: number): Promise<boolean> {
// Mock implementation - default to false
return false;
}
async getTeamsAutoOptIn(_teamIds: number[]): Promise<Record<number, boolean>> {
// Mock implementation - return empty (all teams default to false)
return {};
}
async setUserAutoOptIn(_userId: number, _enabled: boolean): Promise<void> {
// Mock implementation - do nothing
}
async setTeamAutoOptIn(_teamId: number, _enabled: boolean): Promise<void> {
// Mock implementation - do nothing
}
}