en.javascript.info/1-js/6-objects-more/6-call-apply/2-apply-function-skip-first-argument/_js.view/test.js
2015-03-09 18:48:58 +03:00

15 lines
No EOL
475 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

describe("applyAll", function() {
it("применяет функцию ко всем аргументам, начиная со 2го", function() {
var min = applyAll(Math.min, 1, 2, 3);
assert.equal(min, 1);
});
it("при отсутствии аргументов просто вызывает функцию", function() {
var spy = sinon.spy();
applyAll(spy);
assert(spy.calledOnce);
assert.equal(spy.firstCall.args.length, 0);
});
});