plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
+ require('karma-phantomjs-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
- browsers: ['Chrome'],
- singleRun: false
+ browsers: ['PhantomJS'],
+ singleRun: true
});
};
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.1",
- "@angular/cli": "6.0.1",
+ "@angular/cli": "^6.0.1",
"@angular/compiler-cli": "6.0.1",
"@angular/language-service": "6.0.1",
"@types/jasmine": "~2.5.53",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
+ "karma-phantomjs-launcher": "^1.0.4",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
--- /dev/null
+import {EgEventService} from './event.service';
+
+describe('EgEventService', function(){
+ let service: EgEventService;
+ beforeEach(() => {service = new EgEventService();});
+
+ let evt = {
+ ilsevent: "12345",
+ pid: "12345",
+ desc: "Test Event Description",
+ payload: {test : 'xyz'},
+ textcode: "TEST_EVENT",
+ servertime: "Wed Nov 6 16:05:50 2013"
+ };
+
+ it('should parse an event object', () => {
+ expect(service.parse(evt)).not.toBe(null);
+ });
+
+ it('should not parse a non-event', () => {
+ expect(service.parse({})).toBe(null);
+ });
+
+ it('should not parse a non-event', () => {
+ expect(service.parse({abc : '123'})).toBe(null);
+ });
+
+ it('should not parse a non-event', () => {
+ expect(service.parse([])).toBe(null);
+ });
+
+ it('should not parse a non-event', () => {
+ expect(service.parse('STRING')).toBe(null);
+ });
+
+ it('should not parse a non-event', () => {
+ expect(service.parse(true)).toBe(null);
+ });
+
+ it('should stringify an event', () => {
+ expect(service.parse(evt).toString()).toBe(
+ 'Event: 12345:TEST_EVENT -> Test Event Description')
+ });
+
+});
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';
+// PhantomJS needs these
+import 'core-js/es6/array';
+import 'core-js/es6/string';
+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.