@@ -33,21 +33,24 @@ describe('the deploy plugin object', function() {
3333 name : 'test-plugin'
3434 } ) ;
3535
36- assert . equal ( typeof result . build , 'function' ) ;
36+ assert . equal ( typeof result . didBuild , 'function' ) ;
3737 } ) ;
3838
39- describe ( 'build hook' , function ( ) {
40- it ( 'generates index.json from index.html' , function ( done ) {
41- var build = subject . createDeployPlugin ( {
39+ describe ( 'didBuild hook' , function ( ) {
40+ it ( 'generates index.json from index.html' , function ( ) {
41+ var didBuild = subject . createDeployPlugin ( {
4242 name : 'test-plugin'
43- } ) . build ;
43+ } ) . didBuild ;
4444
45- var buildOptions = {
46- project : { root : fakeRoot } ,
45+ var context = {
46+ deployment : {
47+ project : { root : fakeRoot }
48+ } ,
4749 data : { }
4850 } ;
4951
50- build ( buildOptions )
52+ var promise = didBuild ( context ) ;
53+ return assert . isFulfilled ( promise )
5154 . then ( function ( ) {
5255 var json = require ( fakeRoot + '/dist/index.json' ) ;
5356
@@ -59,33 +62,26 @@ describe('the deploy plugin object', function() {
5962 assert . deepEqual ( json . link [ 1 ] , { rel : 'stylesheet' , href : 'assets/app.css' } ) ;
6063 assert . deepEqual ( json . script [ 0 ] , { src : 'assets/vendor.js' } ) ;
6164 assert . deepEqual ( json . script [ 1 ] , { src : 'assets/app.js' } ) ;
62-
63- done ( ) ;
64- } )
65- . catch ( function ( error ) {
66- done ( error ) ;
6765 } ) ;
6866 } ) ;
6967
70- it ( 'sets the index.json path in the data object ' , function ( done ) {
71- var build = subject . createDeployPlugin ( {
68+ it ( 'returns the index.json path' , function ( ) {
69+ var didBuild = subject . createDeployPlugin ( {
7270 name : 'test-plugin'
73- } ) . build ;
71+ } ) . didBuild ;
7472
7573 var data = { } ;
76- var buildOptions = {
77- project : { root : fakeRoot } ,
78- data : data
74+ var context = {
75+ indexPath : 'dist/index.html' ,
76+ deployment : {
77+ project : { root : fakeRoot }
78+ }
7979 } ;
8080
81- build ( buildOptions )
82- . then ( function ( ) {
83- assert . deepEqual ( data , { indexPath : fakeRoot + '/dist/index.json' } ) ;
84-
85- done ( )
86- } )
87- . catch ( function ( error ) {
88- done ( error ) ;
81+ var promise = didBuild ( context ) ;
82+ return assert . isFulfilled ( promise )
83+ . then ( function ( result ) {
84+ assert . equal ( result . indexPath , fakeRoot + '/dist/index.json' ) ;
8985 } ) ;
9086 } ) ;
9187 } ) ;
0 commit comments