]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/ui/default/staff/test/unit/egEvent.js
LP#1350042 Browser client templates/scripts (phase 1)
[working/Evergreen.git] / Open-ILS / web / js / ui / default / staff / test / unit / egEvent.js
1 'use strict';
2
3 describe('egEvent', function(){
4     beforeEach(module('egCoreMod'));
5
6     var evt = {                                                                           
7         ilsevent: "12345",                                                         
8         pid: "12345",                                                             
9         desc: "Test Event Description",
10         payload: {test : 'xyz'},                                                             
11         textcode: "TEST_EVENT",
12         servertime: "Wed Nov 6 16:05:50 2013"                                     
13     };
14
15     it('should parse an event object', inject(function(egEvent) {
16         expect(egEvent.parse(evt)).not.toBe(null);
17     }));
18
19     it('should not parse a non-event', inject(function(egEvent) {
20         expect(egEvent.parse({})).toBe(null);
21     }));
22
23     it('should not parse a non-event', inject(function(egEvent) {
24         expect(egEvent.parse({abc : '123'})).toBe(null);
25     }));
26
27     it('should not parse a non-event', inject(function(egEvent) {
28         expect(egEvent.parse([])).toBe(null);
29     }));
30
31     it('should not parse a non-event', inject(function(egEvent) {
32         expect(egEvent.parse('STRING')).toBe(null);
33     }));
34
35     it('should not parse a non-event', inject(function(egEvent) {
36         expect(egEvent.parse(true)).toBe(null);
37     }));
38
39     it('should stringify an event', inject(function(egEvent) {
40         expect(egEvent.parse(evt).toString()).toBe(
41             'Event: 12345:TEST_EVENT -> Test Event Description')
42     }));
43
44 });