Guest User

Untitled

a guest
Jan 15th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. it('should be able load company data', inject([HttpClient], (http: HttpClient) => {
  2. const companyList: CompanyVerificationResponseDto = {
  3. companyName: 'testcompany',
  4. kvkNumber: 12345678,
  5. companyPhone: '0612341234',
  6. email: 'testtest@email.com',
  7. accountStatus: 0,
  8. contactPhone: '0631313131'
  9. };
  10.  
  11. managementService.loadData();
  12.  
  13. const headers = new HttpHeaders().set('Content-Type', 'application/json');
  14. const param = new HttpParams().set('token', '1234-1234-1234').append('email', 'testtest@email.com');
  15. const options = {params: param, headers: headers};
  16.  
  17.  
  18. http.get('http://localhost:8080/adminpage', options).subscribe(() => {
  19.  
  20. });
  21.  
  22. const req = httpMock.expectOne('http://localhost:8080/adminpage?token=1234-1234-1234&email=testtest@email.com');
  23. expect(req.request.method).toEqual('GET');
  24.  
  25. req.flush(companyList);
  26. }));
  27.  
  28. afterEach(() => {
  29. httpMock.verify();
  30. });
  31.  
  32. public loadData() {
  33. this.restfulService.url = this.restfulService.getBaseUrl() + '/adminpage';
  34. const param = new HttpParams().set('token', this.restfulService.getLocalStorageToken().token);
  35. const options = {params: param, headers: this.headers};
  36.  
  37. return this.httpClient.get<CompanyVerificationResponseDto[]>(this.restfulService.url, options).subscribe(data => {
  38. this.companyList = data;
  39. this.onSuccesfulReceivedData(data);
  40. },
  41. error => this.restfulService.handleError(error));
  42. }
  43.  
  44. PhantomJS 2.1.1 (Windows 8 0.0.0) ManagementService should be able to accept a company based on email FAILED
  45. Error: Expected no open requests, found 1: GET http://localhost:8080/adminpage in http://localhost:9876/_karma_webpack_/vendor.js (line 32166)
  46. verify@http://localhost:9876/_karma_webpack_/vendor.js:32166:97
  47. http://localhost:9876/_karma_webpack_/main.js:3356:24
  48. invoke@http://localhost:9876/_karma_webpack_/polyfills.js:6843:31
  49. onInvoke@http://localhost:9876/_karma_webpack_/vendor.js:156148:45
  50. invoke@http://localhost:9876/_karma_webpack_/polyfills.js:6842:40
  51. run@http://localhost:9876/_karma_webpack_/polyfills.js:6593:49
  52. runInTestZone@http://localhost:9876/_karma_webpack_/vendor.js:156369:37
  53. http://localhost:9876/_karma_webpack_/vendor.js:156384:33
  54. invoke@http://localhost:9876/_karma_webpack_/polyfills.js:6843:31
  55. run@http://localhost:9876/_karma_webpack_/polyfills.js:6593:49
  56. http://localhost:9876/_karma_webpack_/polyfills.js:7327:37
  57. invokeTask@http://localhost:9876/_karma_webpack_/polyfills.js:6876:36
  58. runTask@http://localhost:9876/_karma_webpack_/polyfills.js:6643:57
  59. drainMicroTaskQueue@http://localhost:9876/_karma_webpack_/polyfills.js:7050:42
Add Comment
Please, Sign In to add comment