snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { renderHook } from '@testing-library/react';
import { useEncryptedRoomDescription } from './useEncryptedRoomDescription';
const wrapper = mockAppRoot();
describe('useEncryptedRoomDescription', () => {
beforeEach(() => {
jest.clearAllMocks();
});
describe.each(['channel', 'team'] as const)('roomType=%s', (roomType) => {
it('returns "Not_available_for_this_workspace" when E2E is disabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription(roomType), {
wrapper: wrapper.withSetting('E2E_Enable', false).build(),
});
const describe = result.current;
expect(describe({ isPrivate: true, encrypted: true })).toBe('Not_available_for_this_workspace');
});
it('returns "Encrypted_not_available" when room is not private and E2E is enabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription(roomType), {
wrapper: wrapper.withSetting('E2E_Enable', true).build(),
});
const describe = result.current;
expect(describe({ isPrivate: false, encrypted: false })).toBe('Encrypted_not_available');
});
it('returns "Encrypted_messages" when private and encrypted are true and E2E is enabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription(roomType), {
wrapper: wrapper.withSetting('E2E_Enable', true).build(),
});
const describe = result.current;
expect(describe({ isPrivate: true, encrypted: true })).toBe('Encrypted_messages');
});
it('returns "Encrypted_messages_false" when private and encrypted are false and E2E is enabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription(roomType), {
wrapper: wrapper.withSetting('E2E_Enable', true).build(),
});
const describe = result.current;
expect(describe({ isPrivate: true, encrypted: false })).toBe('Encrypted_messages_false');
});
});
});
describe('useEncryptedRoomDescription, Portuguese (pt-BR)', () => {
it('returns "Encrypted_not_available" when channel is not private and E2E is enabled,', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withDefaultLanguage('pt-BR')
.withTranslations('pt-BR', 'core', {
Encrypted_not_available: 'Indisponível para {{roomType}} público',
channel: 'canal',
team: 'equipe',
})
.build(),
});
const describe = result.current;
expect(describe({ isPrivate: false, encrypted: false })).toBe('Indisponível para canal público');
});
it('returns "Encrypted_not_available" when team is not private and E2E is enabled,', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withDefaultLanguage('pt-BR')
.withTranslations('pt-BR', 'core', {
Encrypted_not_available: 'Indisponível para {{roomType}} público',
channel: 'canal',
team: 'equipe',
})
.build(),
});
const describe = result.current;
expect(describe({ isPrivate: false, encrypted: false })).toBe('Indisponível para equipe público');
});
it('returns "Encrypted_messages" when channel is private and encrypted are true and E2E is enabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('channel'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withDefaultLanguage('pt-BR')
.withTranslations('pt-BR', 'core', {
// TODO: Improve the portuguese translation with a way to captalize the room type for it to be in the start of the sentence
Encrypted_messages:
'Criptografado de ponta a ponta {{roomType}}. A pesquisa não funcionará com {{roomType}} criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
team: 'equipe',
channel: 'canal',
})
.build(),
});
const describe = result.current;
expect(describe({ isPrivate: true, encrypted: true })).toBe(
'Criptografado de ponta a ponta canal. A pesquisa não funcionará com canal criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
);
});
it('returns "Encrypted_messages" when team is private and encrypted are true and E2E is enabled', () => {
const { result } = renderHook(() => useEncryptedRoomDescription('team'), {
wrapper: mockAppRoot()
.withSetting('E2E_Enable', true)
.withTranslations('pt-BR', 'core', {
Encrypted_messages:
'Criptografado de ponta a ponta {{roomType}}. A pesquisa não funcionará com {{roomType}} criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
channel: 'canal',
team: 'equipe',
})
.withDefaultLanguage('pt-BR')
.build(),
});
const describe = result.current;
expect(describe({ isPrivate: true, encrypted: true })).toBe(
'Criptografado de ponta a ponta equipe. A pesquisa não funcionará com equipe criptografado e as notificações podem não mostrar o conteúdo das mensagens.',
);
});
});