<commit_before>/* tslint:disable:max-line-length */

import { Observable } from 'rxjs/Observable';
import { ApiService } from '.';
import { Response, ResponseOptions } from '@angular/http';
import { Event } from '../models';

let fixture: ApiService;
let httpClientServiceStub: any;
let responseOptions: ResponseOptions;
let setupServiceStub: any = {
  getMachineDetailsConfigCookie() { return '1'; }
};
const eventData = {
    'EventId': 4525328,
    'EventTitle': '<NAME> Event 10-11-16',
    'EventStartDate': '2016-10-29T09:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
};
const eventsData = [{
    'EventId': 4525323,
    'EventTitle': '<NAME> Event 10-11-16',
    'EventStartDate': '2016-10-29T09:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
}, {
    'EventId': 4525342,
    'EventTitle': '(t) Jim Test Service',
    'EventStartDate': '2016-10-29T16:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
}];

describe('ApiService', () => {

  describe('#getEvents', () => {
    const responseData = eventsData;
    beforeEach(() => {
      httpClientServiceStub = {
        get() {
          responseOptions = new ResponseOptions({ body: responseData });
          return Observable.of(new Response(responseOptions));
        }
      };
      fixture = new ApiService(httpClientServiceStub, setupServiceStub);
    });
    it('should successfully get list of events', () => {
      let responseObject = responseData;
      fixture.getEvents('10-11-16', '10-15-16').subscribe((res: Response) => {
        expect(res).toEqual(responseObject);
      });
    });
  });

  describe('#getEvent', () => {
    const responseData = eventData;
    beforeEach(() => {
      httpClientServiceStub = {
        get() {
          responseOptions = new ResponseOptions({ body: responseData });
          return Observable.of(new Response(responseOptions));
        }
      };
      fixture = new ApiService(httpClientServiceStub, setupServiceStub);
    });
    it('should successfully get event', () => {
      let responseObject = responseData;
      fixture.getEvent('453').subscribe((res: Response) => {
        expect(res).toEqual(Event.fromJson(responseObject));
      });
    });
  });

});<commit_msg>US5985: api service getEventMaps test<commit_after>/* tslint:disable:max-line-length */

import { Observable } from 'rxjs/Observable';
import { ApiService } from '.';
import { Response, ResponseOptions } from '@angular/http';
import { Event } from '../models';

let fixture: ApiService;
let httpClientServiceStub: any;
let responseOptions: ResponseOptions;
let setupServiceStub: any = {
  getMachineDetailsConfigCookie() { return '1'; }
};
const eventData = {
    'EventId': 4525328,
    'EventTitle': '<NAME> Event 10-11-16',
    'EventStartDate': '2016-10-29T09:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
};
const eventsData = [{
    'EventId': 4525323,
    'EventTitle': '<NAME> Event 10-11-16',
    'EventStartDate': '2016-10-29T09:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
}, {
    'EventId': 4525342,
    'EventTitle': '(t) Jim Test Service',
    'EventStartDate': '2016-10-29T16:30:00',
    'EventType': 'Service - Oakley',
    'EventSite': 'Oakley'
}];

describe('ApiService', () => {

  describe('#getEvents', () => {
    const responseData = eventsData;
    beforeEach(() => {
      httpClientServiceStub = {
        get() {
          responseOptions = new ResponseOptions({ body: responseData });
          return Observable.of(new Response(responseOptions));
        }
      };
      fixture = new ApiService(httpClientServiceStub, setupServiceStub);
    });
    it('should successfully get list of events', () => {
      let responseObject = responseData;
      fixture.getEvents('10-11-16', '10-15-16').subscribe((res: Response) => {
        expect(res).toEqual(responseObject);
      });
    });
  });

  describe('#getEvent', () => {
    const responseData = eventData;
    beforeEach(() => {
      httpClientServiceStub = {
        get() {
          responseOptions = new ResponseOptions({ body: responseData });
          return Observable.of(new Response(responseOptions));
        }
      };
      fixture = new ApiService(httpClientServiceStub, setupServiceStub);
    });
    it('should successfully get event', () => {
      let responseObject = responseData;
      fixture.getEvent('453').subscribe((res: Response) => {
        expect(res).toEqual(Event.fromJson(responseObject));
      });
    });
  });

  describe('#getEventMaps', () => {
    const responseData = eventsData;
    beforeEach(() => {
      httpClientServiceStub = {
        get() {
          responseOptions = new ResponseOptions({ body: responseData });
          return Observable.of(new Response(responseOptions));
        }
      };
      fixture = new ApiService(httpClientServiceStub, setupServiceStub);
    });
    it('should successfully get event maps', () => {
      let responseObject = responseData;
      fixture.getEvents('453').subscribe((res: Response) => {
        expect(res).toEqual(responseObject);
      });
    });
  });

});
{'fraction_non_alphanumeric': 0.16027131782945736, 'fraction_numerical': 0.03662790697674419, 'mean_word_length': 3.2165032679738563, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3310017', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1554, 'n_words': 312}