The propEqual() is a built-in function of Qunitjs test suite which compare the properties values of two objects.
The propEqual() assertion provides strictly (===) comparison of Object properties. Unlike deepEqual(), this assertion can be used to compare two objects made with different constructors and prototype.
Syntax:
1 | propEqual( actual, expected [, message ] ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | QUnit.test( "propEqual test", function( assert ) { function Foo( x, y, z ) { this.x = x; this.y = y; this.z = z; } Foo.prototype.doA = function () {}; Foo.prototype.doB = function () {}; Foo.prototype.bar = 'prototype'; var foo = new Foo( 1, "2", [] ); var bar = { x : 1, y : "2", z : [] }; assert.propEqual( foo, bar, "Strictly the same properties without comparing objects constructors." ); }); |
Reference: https://api.qunitjs.com/assert/propEqual
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.