1 |
|
2 |
|
3 |
|
4 |
|
5 | var util = require( './util' );
|
6 | var assert = require( 'assert' );
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | describe( 'wpcom.me.publicizeConnection', function() {
|
12 |
|
13 | var wpcom = util.wpcom();
|
14 | var me = wpcom.me();
|
15 |
|
16 | describe( 'wpcom.me.publicizeConnection.get', function() {
|
17 | it( 'should get current user\' publicize connections', function( done ) {
|
18 | me.publicizeConnections( function( err, data ) {
|
19 | if ( err ) throw err;
|
20 |
|
21 | assert.ok( data );
|
22 | assert.ok( data.connections );
|
23 |
|
24 | let connectionId = data.publicize_connections && data.publicize_connections[0]
|
25 | ? data.publicize_connections[0].ID
|
26 | : null;
|
27 |
|
28 | if ( connectionId ) {
|
29 | describe( 'wpcom.me.publicizeConnection.get', function() {
|
30 | it( 'should get user publicize connection through of connection id',
|
31 | function( done2 ) {
|
32 | me.publicizeConnection( connectionId ).get( function( err2, data2 ) {
|
33 | if ( err2 ) throw err2;
|
34 |
|
35 | assert.ok( data2 );
|
36 | assert.equal( connectionId, data2.ID );
|
37 | done2();
|
38 | } );
|
39 | } );
|
40 | } );
|
41 | }
|
42 | done();
|
43 | } );
|
44 | } );
|
45 | } );
|
46 | } );
|