util.test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. var _util = require("./util.js");
  3. describe('findNumbers/util', function () {
  4. it('should generate regexp limit', function () {
  5. var thrower = function thrower() {
  6. return (0, _util.limit)(1, 0);
  7. };
  8. thrower.should["throw"]();
  9. thrower = function thrower() {
  10. return (0, _util.limit)(-1, 1);
  11. };
  12. thrower.should["throw"]();
  13. thrower = function thrower() {
  14. return (0, _util.limit)(0, 0);
  15. };
  16. thrower.should["throw"]();
  17. });
  18. it('should trimAfterFirstMatch', function () {
  19. (0, _util.trimAfterFirstMatch)(/\d/, 'abc123').should.equal('abc');
  20. (0, _util.trimAfterFirstMatch)(/\d/, 'abc').should.equal('abc');
  21. });
  22. it('should determine if a string starts with a substring', function () {
  23. (0, _util.startsWith)('𐍈123', '𐍈').should.equal(true);
  24. (0, _util.startsWith)('1𐍈', '𐍈').should.equal(false);
  25. });
  26. it('should determine if a string ends with a substring', function () {
  27. (0, _util.endsWith)('123𐍈', '𐍈').should.equal(true);
  28. (0, _util.endsWith)('𐍈1', '𐍈').should.equal(false);
  29. });
  30. });
  31. //# sourceMappingURL=util.test.js.map