en.javascript.info/1-js/6-objects-more/3-static-properties-and-methods/1-objects-counter/_js.view/test.js
Ilya Kantor 87bf53d076 update
2014-11-16 01:40:20 +03:00

28 lines
No EOL
745 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("Article.showStats", function() {
before(function() {
sinon.stub(window, "alert");
this.clock = sinon.useFakeTimers();
});
after(function() {
window.alert.restore();
this.clock.restore();
});
it("Выводит число статей и дату создания последней", function() {
new Article();
this.clock.tick(100);
new Article();
Article.showStats();
assert( alert.calledWith('Всего: 2, Последняя: ' + new Date() ) );
});
it("и ещё одна статья...", function() {
this.clock.tick(100);
new Article();
Article.showStats();
assert( alert.calledWith('Всего: 3, Последняя: ' + new Date() ) );
});
});