You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-28 15:22:05 +03:00
Oops, the tests won't work if we don't export the functions
This commit is contained in:
@ -26,13 +26,15 @@ export function voipUserMapperEnabled(): boolean {
|
|||||||
return SdkConfig.get()['voip_mxid_translate_pattern'] !== undefined;
|
return SdkConfig.get()['voip_mxid_translate_pattern'] !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function userToVirtualUser(userId: string, templateString?: string): string {
|
// only exported for tests
|
||||||
|
export function userToVirtualUser(userId: string, templateString?: string): string {
|
||||||
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
||||||
if (!templateString) return null;
|
if (!templateString) return null;
|
||||||
return templateString.replace('${mxid}', encodeURIComponent(userId).replace(/%/g, '=').toLowerCase());
|
return templateString.replace('${mxid}', encodeURIComponent(userId).replace(/%/g, '=').toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
function virtualUserToUser(userId: string, templateString?: string): string {
|
// only exported for tests
|
||||||
|
export function virtualUserToUser(userId: string, templateString?: string): string {
|
||||||
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
if (templateString === undefined) templateString = SdkConfig.get()['voip_mxid_translate_pattern'];
|
||||||
if (!templateString) return null;
|
if (!templateString) return null;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import { userToVirtualUser, virtualUserToUser } from '../src/VoipUserMapper';
|
|||||||
|
|
||||||
const templateString = '@_greatappservice_${mxid}:frooble.example';
|
const templateString = '@_greatappservice_${mxid}:frooble.example';
|
||||||
const realUser = '@alice:boop.example';
|
const realUser = '@alice:boop.example';
|
||||||
const virtualUser = "@_greatappservice_%40alice%3Aboop.example:frooble.example";
|
const virtualUser = "@_greatappservice_=40alice=3aboop.example:frooble.example";
|
||||||
|
|
||||||
describe('VoipUserMapper', function() {
|
describe('VoipUserMapper', function() {
|
||||||
it('translates users to virtual users', function() {
|
it('translates users to virtual users', function() {
|
||||||
|
Reference in New Issue
Block a user