Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | import {getTestBed, TestBed} from '@angular/core/testing'; |
| 2 | import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; |
| 3 | import {MsoService} from './mso.service'; |
| 4 | import {Constants} from "../../utils/constants"; |
| 5 | |
| 6 | |
| 7 | describe('Mso Service', () => { |
| 8 | let injector; |
| 9 | let service: MsoService; |
| 10 | let httpMock: HttpTestingController; |
| 11 | |
| 12 | beforeAll(done => (async () => { |
| 13 | TestBed.configureTestingModule({ |
| 14 | imports: [HttpClientTestingModule], |
| 15 | providers: [MsoService] |
| 16 | }); |
| 17 | await TestBed.compileComponents(); |
| 18 | |
| 19 | |
| 20 | injector = getTestBed(); |
| 21 | service = injector.get(MsoService); |
| 22 | httpMock = injector.get(HttpTestingController); |
| 23 | |
| 24 | })().then(done).catch(done.fail)); |
| 25 | |
| 26 | describe('#instantiation status tests ', ()=> { |
| 27 | test('retry should send the right request', ()=>{ |
| 28 | const jobId: string = '111'; |
| 29 | |
| 30 | service.retryMsoTask(jobId).subscribe(); |
| 31 | const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + '/retry/' + jobId); |
| 32 | |
| 33 | expect(req.request.method).toBe('POST'); |
| 34 | }); |
| 35 | }); |
| 36 | |
| 37 | }); |