1 import {EventService} from './event.service';
3 describe('EventService', () => {
4 let service: EventService;
6 service = new EventService();
12 desc: 'Test Event Description',
13 payload: {test : 'xyz'},
14 textcode: 'TEST_EVENT',
15 servertime: 'Wed Nov 6 16:05:50 2013'
18 it('should parse an event object', () => {
19 expect(service.parse(evt)).not.toBe(null);
22 it('should not parse a non-event', () => {
23 expect(service.parse({})).toBe(null);
26 it('should not parse a non-event', () => {
27 expect(service.parse({abc : '123'})).toBe(null);
30 it('should not parse a non-event', () => {
31 expect(service.parse([])).toBe(null);
34 it('should not parse a non-event', () => {
35 expect(service.parse('STRING')).toBe(null);
38 it('should not parse a non-event', () => {
39 expect(service.parse(true)).toBe(null);
42 it('should stringify an event', () => {
43 expect(service.parse(evt).toString()).toBe(
44 'Event: 12345:TEST_EVENT -> Test Event Description');