# Testing a mixin function

I have a mixin function which is as follows -

function mixin(receiver, supplier) {
for (var property in supplier) {
if (supplier.hasOwnProperty(property)) {
}
}
}


To test this function, I am using the ok method of Qunit -

test('Mixin Test Runner', function () {
// using OK method
ok(function () {
name: 'Abul Moksud',
age: '60'
};

var supplier = {
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?

-

Your code is correct, but can be simplified. ok method usually gets an expression rather than a in-place function that is immediately evaluated.

Here is how I would write this test:

test('Mixin Test Runner', function () {
name: 'Abul Moksud',
age: '60'
};

var supplier = {
hands: 2
};