mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 21:00:13 +02:00
add unit test
This commit is contained in:
parent
a59df5b04d
commit
251b070db3
1 changed files with 31 additions and 0 deletions
31
scripts/developer/tests/bindUnitTest.js
Normal file
31
scripts/developer/tests/bindUnitTest.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
Script.include('../libraries/jasmine/jasmine.js');
|
||||||
|
Script.include('../libraries/jasmine/hifi-boot.js');
|
||||||
|
Script.include('../../system/libraries/utils.js');
|
||||||
|
|
||||||
|
describe('Bind', function() {
|
||||||
|
it('functions should have bind available', function() {
|
||||||
|
var foo = 'bar';
|
||||||
|
|
||||||
|
function callAnotherFn(anotherFn) {
|
||||||
|
return anotherFn();
|
||||||
|
}
|
||||||
|
|
||||||
|
function TestConstructor() {
|
||||||
|
this.foo = foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
TestConstructor.prototype.doSomething = function() {
|
||||||
|
return callAnotherFn(function() {
|
||||||
|
return this.foo;
|
||||||
|
}.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
var instance = new TestConstructor();
|
||||||
|
|
||||||
|
expect(typeof(instance.doSomething.bind) !== 'undefined');
|
||||||
|
expect(instance.doSomething()).toEqual(foo);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.getEnv().execute();
|
||||||
|
Script.stop();
|
Loading…
Reference in a new issue