1 |
|
2 |
|
3 |
|
4 | var util = require( './util' );
|
5 | var assert = require( 'assert' );
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | var fixture = require( './fixture' );
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | describe( 'wpcom.site.post.reblog', function() {
|
16 |
|
17 | var wpcom = util.wpcom();
|
18 | var site = wpcom.site( util.site() );
|
19 | var testing_reblog_post = wpcom
|
20 | .site( fixture.reblog.original_blog )
|
21 | .post( fixture.reblog.original_post );
|
22 | var testing_post;
|
23 |
|
24 |
|
25 | before( done => {
|
26 | site.addPost( fixture.post )
|
27 | .then( data => {
|
28 | testing_post = site.post( data.ID );
|
29 | done();
|
30 | } )
|
31 | .catch( done );
|
32 | } );
|
33 |
|
34 | after( done => {
|
35 |
|
36 | testing_post.delete()
|
37 | .then( () => done() )
|
38 | .catch( done );
|
39 | } );
|
40 |
|
41 | describe( 'wpcom.site.post.reblog.add', function() {
|
42 | it( 'should reblog the added post', done => {
|
43 | testing_reblog_post.reblog().add( {
|
44 | note: fixture.reblog.note,
|
45 | destination_site_id: site._id
|
46 | } )
|
47 | .then( data => {
|
48 | assert.ok( data );
|
49 | assert.ok( data.can_reblog );
|
50 | done();
|
51 | } )
|
52 | .catch( done );
|
53 | } );
|
54 | } );
|
55 |
|
56 | describe( 'wpcom.site.post.reblog.to', function() {
|
57 | it( 'should get reblog the added post', done => {
|
58 | testing_reblog_post.reblog().to( site._id, fixture.reblog.note + '-to' )
|
59 | .then( data => {
|
60 | assert.ok( data );
|
61 | assert.ok( data.can_reblog );
|
62 | done();
|
63 | } )
|
64 | .catch( done );
|
65 | } );
|
66 | } );
|
67 |
|
68 | describe( 'wpcom.site.post.reblog.mine', function() {
|
69 | it( 'should get the post reblog status of mine', done => {
|
70 | testing_post.reblog().mine()
|
71 | .then( data => {
|
72 | assert.ok( data );
|
73 | assert.ok( data.can_reblog );
|
74 | done();
|
75 | } )
|
76 | .catch( done );
|
77 | } );
|
78 | } );
|
79 | } );
|