diff --git a/app/lib/methods/helpers/getAvatarUrl.test.ts b/app/lib/methods/helpers/getAvatarUrl.test.ts index 8cc48e60a..e778e1450 100644 --- a/app/lib/methods/helpers/getAvatarUrl.test.ts +++ b/app/lib/methods/helpers/getAvatarUrl.test.ts @@ -2,26 +2,31 @@ import { formatUrl } from './getAvatarUrl'; jest.mock('react-native', () => ({ PixelRatio: { get: () => 1 } })); -describe('Test the formatURL', () => { - it('format as default to get the avatar from an user', () => { +describe('formatUrl function', () => { + test('formats the default URL to get the user avatar', () => { const url = 'https://mobile.rocket.chat/avatar/reinaldoneto'; const size = 30; const query = '&extraparam=true'; - const expectedResult = `https://mobile.rocket.chat/avatar/reinaldoneto?format=png&size=30&extraparam=true`; - expect(formatUrl(url, size, query)).toBe(expectedResult); + const expected = 'https://mobile.rocket.chat/avatar/reinaldoneto?format=png&size=30&extraparam=true'; + const result = formatUrl(url, size, query); + expect(result).toEqual(expected); }); - it('format external provider uri to get the avatar from an user', () => { + + test('formats an external provider URI to get the user avatar', () => { const url = 'https://open.rocket.chat/avatar/reinaldoneto'; const size = 30; const query = undefined; - const expectedResult = `https://open.rocket.chat/avatar/reinaldoneto?format=png&size=30`; - expect(formatUrl(url, size, query)).toBe(expectedResult); + const expected = 'https://open.rocket.chat/avatar/reinaldoneto?format=png&size=30'; + const result = formatUrl(url, size, query); + expect(result).toEqual(expected); }); - it('format external provider uri that already adds a query to get the avatar from an user', () => { + + test('formats an external provider URI that already includes a query to get the user avatar', () => { const url = 'https://open.rocket.chat/avatar?rcusername=reinaldoneto'; const size = 30; const query = undefined; - const expectedResult = `https://open.rocket.chat/avatar?rcusername=reinaldoneto&format=png&size=30`; - expect(formatUrl(url, size, query)).toBe(expectedResult); + const expected = 'https://open.rocket.chat/avatar?rcusername=reinaldoneto&format=png&size=30'; + const result = formatUrl(url, size, query); + expect(result).toEqual(expected); }); });