UNPKG

1.14 kBJavaScriptView Raw
1
2/**
3 * Module dependencies
4 */
5var util = require( './util' );
6var assert = require( 'assert' );
7
8/**
9 * me.connectedconnection
10 */
11describe( 'wpcom.me.publicizeConnection', function() {
12 // Global instances
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} );