string-utils.js 970 B

1234567891011121314151617181920212223
  1. (function (startsWith, endsWith) {
  2. 'use strict';
  3. QUnit.module("String Utils");
  4. QUnit.test("startsWith utility", function(assert) {
  5. assert.expect(4);
  6. assert.ok(startsWith("Boberson", "Bob"), 'found string at beginning of other string');
  7. assert.ok(!startsWith("Boberson", "bob"), 'function is case sensitive');
  8. assert.ok(!startsWith("Bob", "Boberson"), 'failed to find string at beginning of other string');
  9. assert.ok(!startsWith("", "Boberson"), 'tested empty string');
  10. });
  11. QUnit.test("endsWith utility", function(assert) {
  12. assert.expect(4);
  13. assert.ok(endsWith("Boberson", "son"), 'found string at the end of other string');
  14. assert.ok(!endsWith("Boberson", "Son"), 'function is case sensitive');
  15. assert.ok(!endsWith("Bob", "Boberson"), 'failed to find string at the end of other string');
  16. assert.ok(!endsWith("", "Boberson"), 'tested empty string');
  17. });
  18. }(Misago.prototype.startsWith, Misago.prototype.endsWith));