@@ -65,4 +65,55 @@ describe('Api Tests', function() {
6565 } ) ;
6666 } ) ;
6767 } ) ;
68+
69+ it ( 'should update a test by specifying legacy data' , function ( done ) {
70+ var that = this ;
71+ this . api . getTests ( function ( err , response ) {
72+ assert . equal ( response . data && response . data . length > 0 , true ) ;
73+ var singleTest = response . data [ 0 ] ;
74+ that . api . getTestDetails ( singleTest . id , function ( err , response ) {
75+ assert . notEqual ( response , null ) ;
76+ var payload = { "test[success]" : "1" , "test[status_message]" : "test" } ;
77+ that . api . updateTest ( payload , singleTest . id , function ( err ) {
78+ that . api . getTestDetails ( singleTest . id , function ( err , response ) {
79+ assert . equal ( response . status_message , "test" ) ;
80+ done ( ) ;
81+ } ) ;
82+ } ) ;
83+ } ) ;
84+ } ) ;
85+ } ) ;
86+
87+ it ( 'should update a test by specifying object data' , function ( done ) {
88+ var that = this ;
89+ this . api . getTests ( function ( err , response ) {
90+ assert . equal ( response . data && response . data . length > 0 , true ) ;
91+ var singleTest = response . data [ 0 ] ;
92+ that . api . getTestDetails ( singleTest . id , function ( err , response ) {
93+ assert . notEqual ( response , null ) ;
94+ var payload = { test : { success : 1 , status_message : "test2" } } ;
95+ that . api . updateTest ( payload , singleTest . id , function ( err ) {
96+ that . api . getTestDetails ( singleTest . id , function ( err , response ) {
97+ assert . equal ( response . status_message , "test2" ) ;
98+ done ( ) ;
99+ } ) ;
100+ } ) ;
101+ } ) ;
102+ } ) ;
103+ } ) ;
104+
105+ it ( 'should be possible to delete a test' , function ( done ) {
106+ var that = this ;
107+ this . api . getTests ( function ( err , response ) {
108+ assert . equal ( response . data && response . data . length > 0 , true ) ;
109+ var singleTest = response . data [ 0 ] ;
110+ that . api . deleteTest ( singleTest . id , function ( err , response ) {
111+ that . api . getTestDetails ( singleTest . id , function ( err , response ) {
112+ assert . equal ( response , null ) ;
113+ assert . notEqual ( err , null ) ;
114+ done ( ) ;
115+ } ) ;
116+ } ) ;
117+ } ) ;
118+ } ) ;
68119} ) ;
0 commit comments