I have a mixin function which is as follows -
function mixin(receiver, supplier) {
for (var property in supplier) {
if (supplier.hasOwnProperty(property)) {
receiver[property] = supplier[property];
}
}
}
To test this function, I am using the ok method of Qunit -
test('Mixin Test Runner', function () {
// using OK method
ok(function () {
var receiver = {
name: 'Abul Moksud',
age: '60'
};
var supplier = {
hands: 2
};
mixin(receiver, supplier);
return receiver.hasOwnProperty('hands') && (receiver.hands === 2);
}(), "Abul Moksud now has two hands");
});
I am an absolute beginner in both unit testing and QUnit. Is my approach OK here, or is there any better option?