@@ -156,6 +156,53 @@ describe(__filename, function(){
156156
157157 it ( 'should add a breakpoint' ) ;
158158
159+ it ( 'should report error on breakpoint set' , function ( done ) {
160+ var debuglet = new Debuglet (
161+ config , logger . create ( config . logLevel , '@google/cloud-debug' ) ) ;
162+
163+ process . env . GCLOUD_PROJECT_NUM = 0 ;
164+
165+ var bp = {
166+ id : 'test' ,
167+ location : { path : 'fixtures/foo' , line : 2 }
168+ } ;
169+
170+ var API = 'https://clouddebugger.googleapis.com' ;
171+
172+ var scope = nock ( API )
173+ . post ( '/v2/controller/debuggees/register' )
174+ . reply ( 200 , {
175+ debuggee : {
176+ id : 'bar'
177+ }
178+ } )
179+ . get ( '/v2/controller/debuggees/bar/breakpoints' )
180+ . reply ( 200 , {
181+ breakpoints : [ bp ]
182+ } )
183+ . put ( '/v2/controller/debuggees/bar/breakpoints/test' , function ( body ) {
184+ var status = body . breakpoint . status ;
185+ return status . isError &&
186+ status . description . format . indexOf ( 'Only files with .js extensions' ) !== - 1 ;
187+ } )
188+ . reply ( 200 ) ;
189+
190+ debuglet . once ( 'started' , function ( ) {
191+ debuglet . debugletApi_ . request_ = request ; // Avoid authing.
192+ } ) ;
193+ debuglet . once ( 'registered' , function ( id ) {
194+ assert ( id === 'bar' ) ;
195+ setTimeout ( function ( ) {
196+ assert ( ! debuglet . activeBreakpointMap_ . test ) ;
197+ debuglet . stop ( ) ;
198+ scope . done ( ) ;
199+ done ( ) ;
200+ } , 200 ) ;
201+ } ) ;
202+
203+ debuglet . start ( ) ;
204+ } ) ;
205+
159206 it ( 'should expire stale breakpoints' , function ( done ) {
160207 var oldTimeout = config . breakpointExpirationSec ;
161208 config . breakpointExpirationSec = 1 ;
0 commit comments