mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
Normalizes plugin trust badge rendering across Home, plugin details, registry entries, sources, and plugin share/install surfaces while mapping bundled and official sources to the user-facing Official tier.
Validation: CI and nix-check were green on PR head 1a68f20571.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
import { TrustBadge } from '../../src/components/TrustBadge';
|
|
|
|
describe('TrustBadge', () => {
|
|
it('normalizes bundled installed plugins to the user-facing Official tier', () => {
|
|
const html = renderToStaticMarkup(<TrustBadge trust="bundled" />);
|
|
|
|
expect(html).toContain('Official');
|
|
expect(html).toContain('plugin-trust-badge--official');
|
|
expect(html).toContain('data-trust-tier="official"');
|
|
expect(html).toContain('Open Design official');
|
|
});
|
|
|
|
it('uses one visual API for marketplace trust tiers', () => {
|
|
const html = renderToStaticMarkup(
|
|
<>
|
|
<TrustBadge trust="official" />
|
|
<TrustBadge trust="trusted" />
|
|
<TrustBadge trust="restricted" />
|
|
</>,
|
|
);
|
|
|
|
expect(html).toContain('plugin-trust-badge--official');
|
|
expect(html).toContain('plugin-trust-badge--trusted');
|
|
expect(html).toContain('plugin-trust-badge--restricted');
|
|
expect(html).toContain('Community trusted');
|
|
expect(html).toContain('Restricted source');
|
|
});
|
|
|
|
it('allows contextual text while preserving the trust tier styling', () => {
|
|
const html = renderToStaticMarkup(
|
|
<TrustBadge trust="official" label="Action plugin" />,
|
|
);
|
|
|
|
expect(html).toContain('Action plugin');
|
|
expect(html).toContain('plugin-trust-badge--official');
|
|
expect(html).toContain('aria-label="Open Design official: Action plugin"');
|
|
});
|
|
});
|