File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ module.exports.twitter = function twitter(username) {
7
7
return 'https://x.com/' + username . replace ( / ^ @ / , '' ) ;
8
8
} ;
9
9
10
+ // Alias for twitter to support X
11
+ module . exports . x = module . exports . twitter ;
12
+
10
13
/**
11
14
* @param {string } username
12
15
* @returns {string }
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ describe('lib/social: urls', function () {
11
11
should . exist ( social . twitter ) ;
12
12
} ) ;
13
13
14
+ it ( 'should have a x url function' , function ( ) {
15
+ should . exist ( social . x ) ;
16
+ } ) ;
17
+
14
18
it ( 'should have a facebook url function' , function ( ) {
15
19
should . exist ( social . facebook ) ;
16
20
} ) ;
@@ -53,6 +57,16 @@ describe('lib/social: urls', function () {
53
57
} ) ;
54
58
} ) ;
55
59
60
+ describe ( 'x' , function ( ) {
61
+ it ( 'should return a correct concatenated URL' , function ( ) {
62
+ social . x ( '@myusername' ) . should . eql ( 'https://x.com/myusername' ) ;
63
+ } ) ;
64
+
65
+ it ( 'should return a url without an @ sign if one is provided' , function ( ) {
66
+ social . x ( 'myusername' ) . should . eql ( 'https://x.com/myusername' ) ;
67
+ } ) ;
68
+ } ) ;
69
+
56
70
describe ( 'facebook' , function ( ) {
57
71
it ( 'should return a correct concatenated URL' , function ( ) {
58
72
social . facebook ( 'myusername' ) . should . eql ( 'https://www.facebook.com/myusername' ) ;
You can’t perform that action at this time.
0 commit comments