@@ -64,17 +64,26 @@ describe('StartIO ID System', function () {
6464 } ) ;
6565
6666 describe ( 'getId' , function ( ) {
67- it ( 'should log an error if no endpoint configured' , function ( ) {
67+ it ( 'should return callback and fire ajax even if no endpoint configured' , function ( ) {
6868 const config = { params : { } } ;
69- startioIdSubmodule . getId ( config ) ;
70- expect ( utils . logError . calledOnce ) . to . be . true ;
71- expect ( utils . logError . args [ 0 ] [ 0 ] ) . to . include ( 'requires an endpoint' ) ;
69+ const result = startioIdSubmodule . getId ( config ) ;
70+ expect ( result ) . to . have . property ( 'callback' ) ;
71+ expect ( typeof result . callback ) . to . equal ( 'function' ) ;
72+
73+ const callbackSpy = sinon . spy ( ) ;
74+ result . callback ( callbackSpy ) ;
75+ expect ( server . requests . length ) . to . equal ( 1 ) ;
7276 } ) ;
7377
74- it ( 'should log an error if endpoint is not a string' , function ( ) {
78+ it ( 'should return callback and fire ajax even if endpoint is not a string' , function ( ) {
7579 const config = { params : { endpoint : 123 } } ;
76- startioIdSubmodule . getId ( config ) ;
77- expect ( utils . logError . calledOnce ) . to . be . true ;
80+ const result = startioIdSubmodule . getId ( config ) ;
81+ expect ( result ) . to . have . property ( 'callback' ) ;
82+ expect ( typeof result . callback ) . to . equal ( 'function' ) ;
83+
84+ const callbackSpy = sinon . spy ( ) ;
85+ result . callback ( callbackSpy ) ;
86+ expect ( server . requests . length ) . to . equal ( 1 ) ;
7887 } ) ;
7988
8089 it ( 'should return existing storedId immediately if provided' , function ( ) {
0 commit comments