Exemplo n.º 1
0
 it('should parse to proper length of defined api', function(done) {
   parser.parseAPI( json, function(routes) {
     expect(routes).not.toBeUndefined();
     expect(routes instanceof Array).toEqual(true);
     expect(routes.length).toEqual(2);
     done();
   });
 });
Exemplo n.º 2
0
 loadPromise.then( function(json) {
   // update Session.
   session.init(jsonURL, json);
   // parse and add routes to router.
   parser.parseAPI(json, function(routeList) {
     i = 0;
     length = routeList.length;
     for( i; i < length; i++ ) {
       route = routeList[i];
       addRouteToApplication = addPathFromRoute(route);
       if( !addRouteToApplication ) {
         logger.error('Could not add route: ' + JSON.stringify(route, null, 2) + '.');
       }
     }
     apiPromise.resolve();
 },
 function(errorMessage) {
   apiPromise.reject('Error in parsing api.json to routes: ' + errorMessage);
 });
 }, function(error) {
Exemplo n.º 3
0
 it('should notify callback on success', function(done) {
   parser.parseAPI( json, function(routes) {
     // we got here on success.
     done();
   });
 });
Exemplo n.º 4
0
 it('should notify callback on fault with message String', function(done) {
   parser.parseAPI( null, null, function(error) {
     expect(error).toEqual(jasmine.any(String));
     done();
   });
 });