mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
9b3f5c5a90
* docs: relicense Sencho to AGPLv3 and reframe Community positioning Replace BSL with AGPLv3 for the public Community product, update contributor and licensing copy for Community-focused contributions, and surface source and license links in Settings About. * docs: clarify CLA scope and Community contribution framing * fix(ui): split About link constants and harden AboutSection test selectors
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import { describe, it, expect, vi, beforeAll } from 'vitest';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { AboutSection } from '../AboutSection';
|
|
import { ABOUT_LINK_URLS } from '../aboutLinks';
|
|
|
|
beforeAll(() => {
|
|
// Vite injects this at build time; tests need a stand-in.
|
|
(globalThis as unknown as { __APP_VERSION__: string }).__APP_VERSION__ = '0.0.0-test';
|
|
});
|
|
|
|
vi.mock('@/context/LicenseContext', () => ({
|
|
useLicense: () => ({
|
|
license: {
|
|
tier: 'community',
|
|
status: 'community',
|
|
customerName: null,
|
|
productName: null,
|
|
maskedKey: null,
|
|
validUntil: null,
|
|
trialDaysRemaining: null,
|
|
instanceId: 'abcdef0123456789',
|
|
portalUrl: null,
|
|
isLifetime: false,
|
|
},
|
|
isPaid: false,
|
|
loading: false,
|
|
licenseStatus: 'ready',
|
|
licenseReady: true,
|
|
refresh: vi.fn(),
|
|
activate: vi.fn(),
|
|
deactivate: vi.fn(),
|
|
}),
|
|
}));
|
|
|
|
vi.mock('@/components/TierBadge', () => ({
|
|
TierBadge: () => <span>Community</span>,
|
|
}));
|
|
|
|
describe('AboutSection', () => {
|
|
it('renders Plan status and Source, License, and Licensing docs links with exact URLs', () => {
|
|
render(<AboutSection />);
|
|
|
|
expect(screen.getByText('Plan status')).toBeTruthy();
|
|
expect(screen.queryByText('License status')).toBeNull();
|
|
|
|
const source = screen.getByRole('link', { name: 'github.com/studio-saelix/sencho →' });
|
|
expect(source.getAttribute('href')).toBe(ABOUT_LINK_URLS.source);
|
|
expect(source.getAttribute('target')).toBe('_blank');
|
|
expect(source.getAttribute('rel')).toBe('noopener noreferrer');
|
|
|
|
const license = screen.getByRole('link', { name: 'LICENSE →' });
|
|
expect(license.getAttribute('href')).toBe(ABOUT_LINK_URLS.license);
|
|
expect(license.getAttribute('target')).toBe('_blank');
|
|
expect(license.getAttribute('rel')).toBe('noopener noreferrer');
|
|
|
|
const licensingDocs = screen.getByRole('link', {
|
|
name: 'docs.sencho.io/features/licensing →',
|
|
});
|
|
expect(licensingDocs.getAttribute('href')).toBe(ABOUT_LINK_URLS.licensingDocs);
|
|
expect(licensingDocs.getAttribute('target')).toBe('_blank');
|
|
expect(licensingDocs.getAttribute('rel')).toBe('noopener noreferrer');
|
|
|
|
expect(screen.getByText('Source code')).toBeTruthy();
|
|
expect(screen.getByText('AGPLv3 License')).toBeTruthy();
|
|
expect(screen.getByText('Licensing documentation')).toBeTruthy();
|
|
});
|
|
});
|