Compare commits

..

No commits in common. "01cfbdba8b5f6e3b4f9a5e4f48666adcb817b8cb" and "3b2384af25a3df3f2105435ebf50576c81cfede8" have entirely different histories.

3 changed files with 1 additions and 53 deletions

View file

@ -49,7 +49,7 @@ src/
│ ├── shared/ # Composants réutilisables │ ├── shared/ # Composants réutilisables
│ └── transactions/ # Transactions │ └── transactions/ # Transactions
├── contexts/ # ProfileContext (état global profil) ├── contexts/ # ProfileContext (état global profil)
├── hooks/ # 13 hooks custom (useReducer) ├── hooks/ # 12 hooks custom (useReducer)
├── pages/ # 11 pages ├── pages/ # 11 pages
├── services/ # 14 services métier ├── services/ # 14 services métier
├── shared/ # Types et constantes partagés ├── shared/ # Types et constantes partagés

View file

@ -1,42 +0,0 @@
import { describe, it, expect, vi } from "vitest";
import { useIsPremium } from "./useIsPremium";
vi.mock("./useLicense", () => ({
useLicense: vi.fn(),
}));
import { useLicense } from "./useLicense";
const mockUseLicense = vi.mocked(useLicense);
describe("useIsPremium", () => {
it('returns true when edition is "premium"', () => {
mockUseLicense.mockReturnValue({
state: { status: "ready", edition: "premium", info: null, error: null },
refresh: vi.fn(),
submitKey: vi.fn(),
checkEntitlement: vi.fn(),
});
expect(useIsPremium()).toBe(true);
});
it('returns false when edition is "base"', () => {
mockUseLicense.mockReturnValue({
state: { status: "ready", edition: "base", info: null, error: null },
refresh: vi.fn(),
submitKey: vi.fn(),
checkEntitlement: vi.fn(),
});
expect(useIsPremium()).toBe(false);
});
it('returns false when edition is "free"', () => {
mockUseLicense.mockReturnValue({
state: { status: "ready", edition: "free", info: null, error: null },
refresh: vi.fn(),
submitKey: vi.fn(),
checkEntitlement: vi.fn(),
});
expect(useIsPremium()).toBe(false);
});
});

View file

@ -1,10 +0,0 @@
import { useLicense } from "./useLicense";
/**
* Returns true if the active license edition is "premium".
* Ergonomic helper only the server enforces entitlements independently (cf. ADR 0011 §UX).
*/
export function useIsPremium(): boolean {
const { state } = useLicense();
return state.edition === "premium";
}