This repository was archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathStringUtil-Spec.js
More file actions
41 lines (32 loc) · 1.65 KB
/
Copy pathStringUtil-Spec.js
File metadata and controls
41 lines (32 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
define(function (require, exports, module) {
var StringUtil = require('util/StringUtil');
describe("StringUtil", function() {
it("getExtension()", function() {
expect(StringUtil.getExtension("file.exe")).toEqual("exe");
expect(StringUtil.getExtension("file.jpg.zip")).toEqual("zip");
});
it("hyphenToCamelCase()", function() {
expect(StringUtil.hyphenToCamelCase("hyphen-to-camel-case")).toEqual("hyphenToCamelCase");
expect(StringUtil.hyphenToCamelCase("hyphen-TO-camel-CASE")).toEqual("hyphenToCamelCase");
});
// it("hyphenToPascalCase()", function() {
// expect(StringUtil.hyphenToPascalCase("hyphen-to-camel-case")).toEqual("HyphenToCamelCase");
// expect(StringUtil.hyphenToPascalCase("hyphen-TO-camel-CASE")).toEqual("HyphenToCamelCase");
// });
it("camelCaseToHyphen()", function() {
expect(StringUtil.camelCaseToHyphen("hyphenToCamelCase")).toEqual("hyphen-to-camel-case");
});
// it("queryStringToObject()", function() {
// });
it("removeAllWhitespace()", function() {
expect(StringUtil.removeAllWhitespace(" a b c d e f g ")).toEqual("abcdefg");
});
it("removeLeadingTrailingWhitespace()", function() {
expect(StringUtil.removeLeadingTrailingWhitespace(" a b c d e f g ")).toEqual("a b c d e f g");
});
it("truncate()", function() {
expect(StringUtil.truncate("Robert is cool and he knows it.", 14)).toEqual("Robert is cool...");
});
});
});
//http://net.tutsplus.com/tutorials/javascript-ajax/testing-your-javascript-with-jasmine/