Guest User

Untitled

a guest
Jan 23rd, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.17 KB | None | 0 0
  1. Error: Error in ./ReturnFileParameterComponent class ReturnFileParameterComponent - inline template:2:4 caused by: undefined is not a constructor (evaluating 'this.documentResponsiveListener()') in C:/Users/wlaw/Desktop/ens_fits_ui/karma-shim.js (line 41475)
  2. ngOnDestroy@C:/Users/wlaw/Desktop/ens_fits_ui/karma-shim.js:71991:45 <- webpack:///~/primeng/components/confirmdialog/confirmdialog.js:140:0
  3. ngOnDestroy
  4. destroyInternal
  5. destroy@C:/Users/wlaw/Desktop/ens_fits_ui/karma-shim.js:41076:34 <- webpack:///~/@angular/core/bundles/core.umd.js:12361:0
  6. ...
  7.  
  8. import {
  9. ...
  10. ConfirmDialogModule,
  11. ConfirmationService
  12. } from 'primeng/primeng';
  13.  
  14.  
  15. describe('Return File Parameter Component Test', () => {
  16.  
  17. beforeEach(() => {
  18. TestBed.configureTestingModule({
  19. declarations: [ReturnFileParameterComponent, HtmlUserFriendlyTimePipe, Html24HourDatePipe, DayOfWeekPipe],
  20. providers: [
  21. ...
  22. ConfirmationService,
  23. ...
  24. ],
  25. imports: [
  26. ...
  27. ConfirmDialogModule
  28. ]
  29. });
  30. TestBed.compileComponents();
  31. });
  32.  
  33. ...
  34.  
  35. it('should call add on a new Return File Parameter and submit it to the service', inject(
  36. [ReturnFileParameterComponent, AuthHelper],
  37. (component: ReturnFileParameterComponent, authHelper: AuthHelper) => {
  38. let fixture: ComponentFixture<ReturnFileParameterComponent> =
  39. getTestBed().createComponent(ReturnFileParameterComponent);
  40.  
  41. fixture.componentInstance.ngOnInit()
  42. .then(fixture.detectChanges)
  43. .then(function () {
  44. let newParam = fixture.componentInstance.add();
  45. expect(fixture.componentInstance.selectedParam).toBe(newParam);
  46. expect(fixture.componentInstance.editParam).toBe(true);
  47. });
  48. })
  49. );
  50. });
  51.  
  52. <div class="ui-grid-row" id="return-parameter-table">
  53. <h5>Return File Parameters</h5>
  54. <p-growl [value]="msgs" life="3000"></p-growl>
  55. <p-confirmDialog header="Confirmation" icon="fa fa-question-circle" width="425"></p-confirmDialog>
  56. ...
  57.  
  58. // Fake component class because the ConfirmDialog has issues with Karma/Jasmine
  59. @Component({
  60. selector: 'p-confirmDialog',
  61. template: ''
  62. })
  63. class FakeConfirmDialogComponent {
  64. }
  65.  
  66. describe('Return File Parameter Component Test', () => {
  67.  
  68. beforeEach(() => {
  69. TestBed.configureTestingModule({
  70. declarations: [ReturnFileParameterComponent, HtmlUserFriendlyTimePipe, Html24HourDatePipe, DayOfWeekPipe],
  71. providers: [
  72. ...
  73. ConfirmationService,
  74. ...
  75. ],
  76. imports: [
  77. ConfirmDialogModule,
  78. ...
  79. ]
  80. });
  81. TestBed.overrideModule(ConfirmDialogModule, {
  82. set: {
  83. declarations: [FakeConfirmDialogComponent],
  84. exports: [FakeConfirmDialogComponent]
  85. }
  86. })
  87. TestBed.compileComponents();
  88. });
  89.  
  90. // All my tests here
  91. });
  92.  
  93. import { async, ComponentFixture, TestBed } from '@angular/core/testing'
  94. import { CITComponent } from './cit.component'
  95. import { ReactiveFormsModule } from '@angular/forms'
  96. import { TooltipModule } from 'primeng/tooltip'
  97. import { ConfirmDialogModule } from 'primeng/confirmdialog'
  98. import { NotificationService } from 'src/app/services/notification/notification.service'
  99. import { Router } from '@angular/router'
  100. import { EvaluationService } from 'src/app/services/api/evaluation.service'
  101. import { ConfirmationService } from 'primeng/api'
  102. import { Component } from '@angular/core'
  103.  
  104. // Fake component class because the ConfirmDialog has issues with Karma/Jasmine
  105. @Component({
  106. selector: 'p-confirmDialog',
  107. template: ''
  108. })
  109. class FakeConfirmDialogComponent {}
  110.  
  111. describe('CITComponent', () => {
  112. let component: CITComponent
  113. let fixture: ComponentFixture<CITComponent>
  114.  
  115. beforeEach(async(() => {
  116. const notificationService = jasmine.createSpyObj('NotificationService', ['success', 'warning', 'error'])
  117. const router = jasmine.createSpyObj('Router', ['navigateByUrl'])
  118. const evaluationService = jasmine.createSpyObj('EvaluationService', ['postIndicators'])
  119.  
  120. TestBed.configureTestingModule({
  121. declarations: [ CITComponent ],
  122. imports: [ ReactiveFormsModule, TooltipModule, ConfirmDialogModule ],
  123. providers: [
  124. { provide: NotificationService, useValue: notificationService },
  125. { provide: Router, useValue: router },
  126. { provide: EvaluationService, useValue: evaluationService },
  127. ConfirmationService
  128. ]
  129. })
  130. .overrideModule(ConfirmDialogModule, {
  131. set: {
  132. declarations: [FakeConfirmDialogComponent],
  133. exports: [FakeConfirmDialogComponent]
  134. }
  135. })
  136. .compileComponents()
  137. }))
  138.  
  139. beforeEach(() => {
  140. fixture = TestBed.createComponent(CITComponent)
  141. component = fixture.componentInstance
  142. fixture.detectChanges()
  143. })
  144.  
  145. it('should create', () => {
  146. expect(component).toBeTruthy()
  147. })
  148. })
  149.  
  150. C:entornosremourbanOworkspacesyoopi-front>ng test
  151. 10% building modules 2/2 modules 0 active23 01 2019 18:04:32.302:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
  152. 23 01 2019 18:04:32.305:INFO [launcher]: Launching browser ChromeHeadlessCI with unlimited concurrency
  153. 23 01 2019 18:04:32.311:INFO [launcher]: Starting browser ChromeHeadless 23 01 2019 18:04:38.644:INFO [HeadlessChrome 0.0.0 (Windows 10 0.0.0)]: Connected on socket XsIYJzf_FRJMkn1bAAAA with id 11316169
  154. HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
  155.  
  156. HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
  157. HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
  158.  
  159. HeadlessChrome 0.0.0 (Windows 10 0.0.0) ERROR: 'DEPRECATION: fit and fdescribe will cause your suite to report an 'incomplete' status in Jasmine 3.0'
  160. HeadlessChrome 0.0.0 (Windows 10 0.0.0) EvaluationsComponent should create FAILED
  161. TypeError: Cannot read property 'subscribe' of undefined
  162. at new ConfirmDialog (http://localhost:9876/node_modules/primeng/components/confirmdialog/confirmdialog.js?:39:1)
  163. at createClass (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:18598:1)
  164. at createDirectiveInstance (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:18467:1)
  165. at createViewNodes (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:19693:1)
  166. at callViewAction (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:20009:1)
  167. at execComponentViewsAction (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:19928:1)
  168. at createViewNodes (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:19721:1)
  169. at createRootView (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:19607:1)
  170. at callWithDebugContext (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:20639:1)
  171. at Object.debugCreateRootView [as createRootView] (http://localhost:9876/node_modules/@angular/core/fesm5/core.js?:20125:1)
  172. Expected undefined to be truthy.
  173. at UserContext.<anonymous> (http://localhost:9876/src/app/components/evaluations/evaluations.component.spec.ts?:45:23)
  174. at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/node_modules/zone.js/dist/zone.js?:388:1)
  175. at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/node_modules/zone.js/dist/zone-testing.js?:288:1)
  176. at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:9876/node_modules/zone.js/dist/zone.js?:387:1)
  177. HeadlessChrome 0.0.0 (Windows 10 0.0.0): Executed 1 of 22 (1 FAILED) (0 secs / 0.48 secs)
Add Comment
Please, Sign In to add comment