Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('add new hardware', function() {
- it('new piece of hardware should be in list', inject(function(hardwareRegisterService, $httpBackend) {
- scope.newItem = { 'item-id': '',
- 'item-user': 'Test User',
- 'item-item': 'Test Item',
- 'item-type': 'Test Type',
- 'item-location': 'Test Location',
- 'item-serial': 'Test Serial',
- 'item-date': '11/08/2014',
- 'item-price': '12'
- };
- $httpBackend.expect('POST', '/saveitem', scope.newItem ).respond(200, '{{"item-id": "003", "item-user": "Test User"}');
- $httpBackend.expect('GET', '/getlist', {}).respond(200, '[{"item-id": "003", "item-user": "Test User"}, {"first":"1"}, {"second":"2"}]');
- scope.addNewHardware().then(function(){
- console.log("Hw new list: "+ JSON.stringify(scope.dataList, null, 4));
- //item added into list
- expect(scope.dataList[2]).not.equals(undefined);
- });
- $httpBackend.flush();
- }));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement