mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(client): change twitter to X and update twitter URL's (#64046)
This commit is contained in:
@@ -307,7 +307,7 @@ const publicUserData = {
|
||||
portfolio: testUserData.portfolio,
|
||||
profileUI: testUserData.profileUI,
|
||||
savedChallenges: testUserData.savedChallenges,
|
||||
twitter: 'https://twitter.com/foobar',
|
||||
twitter: 'https://x.com/foobar',
|
||||
bluesky: 'https://bsky.app/profile/foobar',
|
||||
sendQuincyEmail: testUserData.sendQuincyEmail,
|
||||
username: testUserData.username,
|
||||
|
||||
@@ -218,7 +218,7 @@ const publicUserData = {
|
||||
points: 2,
|
||||
portfolio: testUserData.portfolio,
|
||||
profileUI: testUserData.profileUI,
|
||||
twitter: 'https://twitter.com/foobar',
|
||||
twitter: 'https://x.com/foobar',
|
||||
bluesky: 'https://bsky.app/profile/foobar',
|
||||
username: testUserData.username,
|
||||
usernameDisplay: testUserData.usernameDisplay,
|
||||
|
||||
@@ -12,14 +12,12 @@ import {
|
||||
describe('normalize', () => {
|
||||
describe('normalizeTwitter', () => {
|
||||
test('returns the input if it is a url', () => {
|
||||
const url = 'https://twitter.com/a_generic_user';
|
||||
const url = 'https://x.com/a_generic_user';
|
||||
expect(normalizeTwitter(url)).toEqual(url);
|
||||
});
|
||||
test('adds the handle to twitter.com if it is not a url', () => {
|
||||
test('adds the handle to x.com if it is not a url', () => {
|
||||
const handle = '@a_generic_user';
|
||||
expect(normalizeTwitter(handle)).toEqual(
|
||||
'https://twitter.com/a_generic_user'
|
||||
);
|
||||
expect(normalizeTwitter(handle)).toEqual('https://x.com/a_generic_user');
|
||||
});
|
||||
test('returns undefined if that is the input', () => {
|
||||
expect(normalizeTwitter('')).toBeUndefined();
|
||||
|
||||
@@ -35,7 +35,7 @@ export const normalizeTwitter = (
|
||||
try {
|
||||
new URL(handleOrUrl);
|
||||
} catch {
|
||||
url = `https://twitter.com/${handleOrUrl.replace(/^@/, '')}`;
|
||||
url = `https://x.com/${handleOrUrl.replace(/^@/, '')}`;
|
||||
}
|
||||
return url ?? handleOrUrl;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user