Advertisement
Guest User

Untitled

a guest
Aug 27th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     describe('add new hardware', function() {
  2.         it('new piece of hardware should be in list', inject(function(hardwareRegisterService, $httpBackend) {
  3.             scope.newItem = { 'item-id': '',
  4.                 'item-user': 'Test User',
  5.                 'item-item': 'Test Item',
  6.                 'item-type': 'Test Type',
  7.                 'item-location': 'Test Location',
  8.                 'item-serial': 'Test Serial',
  9.                 'item-date': '11/08/2014',
  10.                 'item-price': '12'
  11.             };
  12.  
  13.             $httpBackend.expect('POST', '/saveitem', scope.newItem ).respond(200, '{{"item-id": "003", "item-user": "Test User"}');
  14.             $httpBackend.expect('GET', '/getlist', {}).respond(200, '[{"item-id": "003", "item-user": "Test User"}, {"first":"1"}, {"second":"2"}]');
  15.             scope.addNewHardware().then(function(){
  16.  
  17.                 console.log("Hw new list: "+ JSON.stringify(scope.dataList, null, 4));
  18.  
  19.                 //item added into list
  20.                 expect(scope.dataList[2]).not.equals(undefined);
  21.             });
  22.  
  23.             $httpBackend.flush();
  24.  
  25.  
  26.         }));
  27.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement