blob: 8a0b90d476579dcf6f77a7e6a443c922df6be6c6 [file] [log] [blame]
Matteo Scandolo7bc39c42016-04-20 11:38:42 -07001(function () {
2 'use strict';
3
4 describe('The xos.helper module', function(){
5 describe('The label formatter service', () => {
6
7 let service;
8
9 // load the application module
10 beforeEach(module('xos.helpers'));
11
12 // inject the cartService
13 beforeEach(inject(function (_LabelFormatter_) {
14 // The injector unwraps the underscores (_) from around the parameter names when matching
15 service = _LabelFormatter_;
16 }));
17
18 it('should replace underscores in a string', () => {
19 expect(service._formatByUnderscore('my_test')).toEqual('my test');
20 expect(service._formatByUnderscore('_test')).toEqual('test');
21 });
22
23 it('should split a camel case string', () => {
24 expect(service._formatByUppercase('myTest')).toEqual('my test');
25 });
26
27 it('should capitalize a string', () => {
28 expect(service._capitalize('my test')).toEqual('My test');
29 });
30
31 it('should format an object property to a label', () => {
32 expect(service.format('myWeird_String')).toEqual('My weird string:');
33 });
34
35 });
36 });
37
38})();