Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

every.test.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. var assert = require("@sinonjs/referee-sinon").assert;
  3. var sinon = require("@sinonjs/referee-sinon").sinon;
  4. var every = require("./every");
  5. describe("util/core/every", function() {
  6. it("returns true when the callback function returns true for every element in an iterable", function() {
  7. var obj = [true, true, true, true];
  8. var allTrue = every(obj, function(val) {
  9. return val;
  10. });
  11. assert(allTrue);
  12. });
  13. it("returns false when the callback function returns false for any element in an iterable", function() {
  14. var obj = [true, true, true, false];
  15. var result = every(obj, function(val) {
  16. return val;
  17. });
  18. assert.isFalse(result);
  19. });
  20. it("calls the given callback once for each item in an iterable until it returns false", function() {
  21. var iterableOne = [true, true, true, true];
  22. var iterableTwo = [true, true, false, true];
  23. var callback = sinon.spy(function(val) {
  24. return val;
  25. });
  26. every(iterableOne, callback);
  27. assert.equals(callback.callCount, 4);
  28. callback.resetHistory();
  29. every(iterableTwo, callback);
  30. assert.equals(callback.callCount, 3);
  31. });
  32. });