Vojtech Szocs has posted comments on this change.

Change subject: Added more tests to ovirt.js
......................................................................


Patch Set 2:

(3 comments)

Nice patch! There's lot of potential for improvement, but this is a good start.

http://gerrit.ovirt.org/#/c/34224/2/frontend/ovirtjs/src/test/ObjectUtilSpec.js
File frontend/ovirtjs/src/test/ObjectUtilSpec.js:

Line 16:             expect(diff).toEqual(null);
Line 17: 
Line 18:         });
Line 19: 
Line 20:         it('should work with opaque objects', function(){
This is a very good test case; typically, computeDiff() is called on objects 
but as the implementation descends down into specific properties, these can be 
arrays etc.
Line 21:             var original = [1, 2, 3];
Line 22:             var modified = [5];
Line 23:             var diff = ObjectUtil.computeDiff(original, modified);
Line 24:             expect(diff).toEqual([5]);


http://gerrit.ovirt.org/#/c/34224/2/frontend/ovirtjs/src/test/ResponseSpec.js
File frontend/ovirtjs/src/test/ResponseSpec.js:

Since we have Spec-per-application-component convention, this file could be 
named ResourceSpec, containing test cases for Resource object.
Line 1: var Resource = System.get('../../../src/main/resources').Resource;
Line 2: 
Line 3: describe('Response', function(){
Line 4:     it('should parse reponse data correctly', function() {


Line 6:             id: 'test',
Line 7:             href: '/api'
Line 8:         });
Line 9: 
Line 10:         expect(resource.apiContextPath).toEqual('/api');
This is a good start, you could do more expectations to inspect different 
properties of resource object, for example:
* compare resource.data object (id and href properties) with values used with 
Resource.fromData()
* expect that resource.originalData is logically equivalent to resource.data
* maybe also test update() and delete() functions (which return 
ResourceOperation objects)
Line 11:     });


-- 
To view, visit http://gerrit.ovirt.org/34224
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I67c445d76dacd36291183c9384eb95a5b555ce58
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Jenny Kang <jennykan...@gmail.com>
Gerrit-Reviewer: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to