Guest User

Untitled

a guest
Jun 25th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { CasesProvider } from '../../src/providers/cases/cases';
  2. import { async, inject, TestBed } from '@angular/core/testing';
  3. import { Http, HttpModule } from '@angular/http';
  4. import { AuthorizationProvider } from "../../src/providers/authorization/authorization";
  5. import { Authentications } from "../UtilityUnitTest";
  6.  
  7. describe('Cases provider tests', function () {
  8.  
  9.     beforeEach(async(() => {
  10.         jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
  11.         TestBed.configureTestingModule({
  12.             providers: [
  13.                 CasesProvider,
  14.                 AuthorizationProvider
  15.             ],
  16.             imports: [
  17.                 HttpModule
  18.             ]
  19.         }).compileComponents();
  20.     }));
  21.  
  22.     it('Auth Provider should be load', inject([CasesProvider], (auth) => {
  23.         expect(auth).toBe(TestBed.get(CasesProvider));
  24.     }));
  25.  
  26.     //getCaseList(searchPhrase: string, status: string, pageSize: number, first: number, sort: string = '', order: string = '', contact?: string)
  27.     it('Should get case list', async(() => {
  28.         Authentications.authenticate(TestBed.get(AuthorizationProvider), { username: 'ADMINISTRATOR', password: 'toy2017'}, '1000905').then(()=>{
  29.            
  30.             expect(sessionStorage.getItem('profile-id')).toBe('1000905');
  31.  
  32.             let casesProvider: CasesProvider = TestBed.get(CasesProvider);
  33.             casesProvider.getCaseList('', 'ALL', 20, 0, 'CASE_NUMBER', 'DESC').subscribe(res => {
  34.                 expect(res).not.toBeNull();
  35.                 expect(true).toBe(true);
  36.             }, err => {
  37.                 console.warn("Error: ", err);
  38.                 expect(false).toBe(true);
  39.             });
  40.  
  41.         });
  42.     }))
  43.  
  44. });
Add Comment
Please, Sign In to add comment