Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. describe('SingleArticleComponent', () => {
  2. let route;
  3. let dialogService;
  4. let articlesService;
  5. let ratingsService;
  6. let languagesService;
  7. let uiService;
  8. let router;
  9. let authService;
  10.  
  11. let fixture: ComponentFixture<SingleArticleComponent>;
  12. let component: SingleArticleComponent;
  13.  
  14. beforeEach((async () => {
  15. jest.clearAllMocks();
  16.  
  17. dialogService = {
  18. open() {},
  19. };
  20.  
  21. articlesService = {
  22. getArticleByIdInLang() {},
  23. getOriginalArticle() {},
  24. updateArticle() {},
  25. getAllArticleVersions() {},
  26. };
  27.  
  28. ratingsService = {
  29. getArticleTranslationRatings() {},
  30. rateTranslation() {},
  31. };
  32.  
  33. languagesService = {
  34. displayLanguage$: of(),
  35. };
  36.  
  37. uiService = {
  38. UI$: of(),
  39. };
  40.  
  41. router = {
  42. navigateByUrl() {},
  43. };
  44.  
  45. authService = {
  46. loggedUser$: of(),
  47. };
  48.  
  49. route = {
  50. data: of({
  51. article: {
  52. article: {},
  53. ratings: {},
  54. }
  55. })
  56. };
  57.  
  58. TestBed.configureTestingModule({
  59. imports: [
  60. RouterTestingModule,
  61. BrowserAnimationsModule,
  62. SharedModule,
  63. CommonModule,
  64. ],
  65. declarations: [
  66. SingleArticleComponent,
  67. EditArticleDialogComponent,
  68. RevertArticleVersionComponent,
  69. ArticleRatingsComponent,
  70. AllCommentsComponent,
  71. CommentInfoComponent,
  72. CreateCommentComponent,
  73. EditCommentComponent,
  74. ],
  75. providers: [
  76. DialogService,
  77. ArticlesService,
  78. RatingsService,
  79. LanguagesService,
  80. UIService,
  81. AuthService,
  82. ],
  83.  
  84. })
  85. .overrideProvider(DialogService, { useValue: dialogService })
  86. .overrideProvider(ArticlesService, { useValue: articlesService })
  87. .overrideProvider(RatingsService, { useValue: ratingsService })
  88. .overrideProvider(AuthService, { useValue: authService })
  89. .overrideProvider(ActivatedRoute, { useValue: route })
  90. .overrideProvider(LanguagesService, { useValue: languagesService })
  91. .overrideProvider(UIService, { useValue: uiService })
  92. .compileComponents();
  93.  
  94. fixture = TestBed.createComponent(SingleArticleComponent);
  95. component = fixture.componentInstance;
  96. }));
  97.  
  98. it('should be defined', () => {
  99. expect(component).toBeDefined();
  100. });
  101.  
  102.  
  103. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement