@@ -23,31 +23,27 @@ describe('Sending Domains Library', function() {
2323 reject : SparkPost . prototype . reject
2424 } ;
2525
26- callback = sinon . stub ( ) ;
26+ callback = function ( ) { } ;
2727
2828 sendingDomains = require ( '../../lib/sendingDomains' ) ( client ) ;
2929 } ) ;
3030
3131 describe ( 'list' , function ( ) {
3232 it ( 'should call client get method with the appropriate uri' , function ( ) {
33- client . get . yields ( ) ;
34-
3533 return sendingDomains . list ( callback )
3634 . then ( function ( ) {
3735 expect ( client . get . firstCall . args [ 0 ] ) . to . deep . equal ( { uri : 'sending-domains' } ) ;
38- expect ( callback . callCount ) . to . equal ( 1 ) ;
36+ expect ( client . get . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
3937 } ) ;
4038 } ) ;
4139 } ) ;
4240
4341 describe ( 'get' , function ( ) {
4442 it ( 'should call client get method with the appropriate uri' , function ( ) {
45- client . get . yields ( ) ;
46-
4743 return sendingDomains . get ( 'test' , callback )
4844 . then ( function ( ) {
4945 expect ( client . get . firstCall . args [ 0 ] ) . to . deep . equal ( { uri : 'sending-domains/test' } ) ;
50- expect ( callback . callCount ) . to . equal ( 1 ) ;
46+ expect ( client . get . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
5147 } ) ;
5248 } ) ;
5349
@@ -58,16 +54,14 @@ describe('Sending Domains Library', function() {
5854
5955 describe ( 'create' , function ( ) {
6056 it ( 'should call client post method with the appropriate uri and payload' , function ( ) {
61- client . post . yields ( ) ;
62-
6357 var sendingDomain = {
6458 domain : 'test'
6559 } ;
6660
6761 return sendingDomains . create ( sendingDomain , callback ) . then ( function ( ) {
6862 expect ( client . post . firstCall . args [ 0 ] . uri ) . to . equal ( 'sending-domains' ) ;
6963 expect ( client . post . firstCall . args [ 0 ] . json ) . to . deep . equal ( sendingDomain ) ;
70- expect ( callback . callCount ) . to . equal ( 1 ) ;
64+ expect ( client . post . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
7165 } ) ;
7266 } ) ;
7367
@@ -78,8 +72,6 @@ describe('Sending Domains Library', function() {
7872
7973 describe ( 'update' , function ( ) {
8074 it ( 'should call client put method with the appropriate uri and payload' , function ( ) {
81- client . put . yields ( ) ;
82-
8375 var sendingDomain = {
8476 tracking_domain : 'click.example1.com'
8577 } ;
@@ -88,7 +80,7 @@ describe('Sending Domains Library', function() {
8880 . then ( function ( ) {
8981 expect ( client . put . firstCall . args [ 0 ] . uri ) . to . equal ( 'sending-domains/test' ) ;
9082 expect ( client . put . firstCall . args [ 0 ] . json ) . to . deep . equal ( _ . omit ( sendingDomain , 'domain' ) ) ;
91- expect ( callback . callCount ) . to . equal ( 1 ) ;
83+ expect ( client . put . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
9284 } ) ;
9385 } ) ;
9486
@@ -103,12 +95,10 @@ describe('Sending Domains Library', function() {
10395
10496 describe ( 'delete' , function ( ) {
10597 it ( 'should call client delete method with the appropriate uri' , function ( ) {
106- client . delete . yields ( ) ;
107-
10898 return sendingDomains . delete ( 'test' , callback )
10999 . then ( function ( ) {
110100 expect ( client . delete . firstCall . args [ 0 ] . uri ) . to . equal ( 'sending-domains/test' ) ;
111- expect ( callback . callCount ) . to . equal ( 1 ) ;
101+ expect ( client . delete . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
112102 } ) ;
113103 } ) ;
114104
@@ -119,8 +109,6 @@ describe('Sending Domains Library', function() {
119109
120110 describe ( 'verify' , function ( ) {
121111 it ( 'should call client post method with the appropriate uri and payload' , function ( ) {
122- client . post . yields ( ) ;
123-
124112 var options = {
125113 dkim_verify : true ,
126114 spf_verify : true
@@ -130,7 +118,7 @@ describe('Sending Domains Library', function() {
130118 . then ( function ( ) {
131119 expect ( client . post . firstCall . args [ 0 ] . uri ) . to . equal ( 'sending-domains/test/verify' ) ;
132120 expect ( client . post . firstCall . args [ 0 ] . json ) . to . deep . equal ( _ . omit ( options , 'domain' ) ) ;
133- expect ( callback . callCount ) . to . equal ( 1 ) ;
121+ expect ( client . post . firstCall . args [ 1 ] ) . to . equal ( callback ) ;
134122 } ) ;
135123 } ) ;
136124
0 commit comments