Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { CasesProvider } from '../../src/providers/cases/cases';
- import { async, inject, TestBed } from '@angular/core/testing';
- import { Http, HttpModule } from '@angular/http';
- import { AuthorizationProvider } from "../../src/providers/authorization/authorization";
- import { Authentications } from "../UtilityUnitTest";
- describe('Cases provider tests', function () {
- beforeEach(async(() => {
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
- TestBed.configureTestingModule({
- providers: [
- CasesProvider,
- AuthorizationProvider
- ],
- imports: [
- HttpModule
- ]
- }).compileComponents();
- }));
- it('Auth Provider should be load', inject([CasesProvider], (auth) => {
- expect(auth).toBe(TestBed.get(CasesProvider));
- }));
- //getCaseList(searchPhrase: string, status: string, pageSize: number, first: number, sort: string = '', order: string = '', contact?: string)
- it('Should get case list', async(() => {
- Authentications.authenticate(TestBed.get(AuthorizationProvider), { username: 'ADMINISTRATOR', password: 'toy2017'}, '1000905').then(()=>{
- expect(sessionStorage.getItem('profile-id')).toBe('1000905');
- let casesProvider: CasesProvider = TestBed.get(CasesProvider);
- casesProvider.getCaseList('', 'ALL', 20, 0, 'CASE_NUMBER', 'DESC').subscribe(res => {
- expect(res).not.toBeNull();
- expect(true).toBe(true);
- }, err => {
- console.warn("Error: ", err);
- expect(false).toBe(true);
- });
- });
- }))
- });
Add Comment
Please, Sign In to add comment