Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('SingleArticleComponent', () => {
- let route;
- let dialogService;
- let articlesService;
- let ratingsService;
- let languagesService;
- let uiService;
- let router;
- let authService;
- let fixture: ComponentFixture<SingleArticleComponent>;
- let component: SingleArticleComponent;
- beforeEach((async () => {
- jest.clearAllMocks();
- dialogService = {
- open() {},
- };
- articlesService = {
- getArticleByIdInLang() {},
- getOriginalArticle() {},
- updateArticle() {},
- getAllArticleVersions() {},
- };
- ratingsService = {
- getArticleTranslationRatings() {},
- rateTranslation() {},
- };
- languagesService = {
- displayLanguage$: of(),
- };
- uiService = {
- UI$: of(),
- };
- router = {
- navigateByUrl() {},
- };
- authService = {
- loggedUser$: of(),
- };
- route = {
- data: of({
- article: {
- article: {},
- ratings: {},
- }
- })
- };
- TestBed.configureTestingModule({
- imports: [
- RouterTestingModule,
- BrowserAnimationsModule,
- SharedModule,
- CommonModule,
- ],
- declarations: [
- SingleArticleComponent,
- EditArticleDialogComponent,
- RevertArticleVersionComponent,
- ArticleRatingsComponent,
- AllCommentsComponent,
- CommentInfoComponent,
- CreateCommentComponent,
- EditCommentComponent,
- ],
- providers: [
- DialogService,
- ArticlesService,
- RatingsService,
- LanguagesService,
- UIService,
- AuthService,
- ],
- })
- .overrideProvider(DialogService, { useValue: dialogService })
- .overrideProvider(ArticlesService, { useValue: articlesService })
- .overrideProvider(RatingsService, { useValue: ratingsService })
- .overrideProvider(AuthService, { useValue: authService })
- .overrideProvider(ActivatedRoute, { useValue: route })
- .overrideProvider(LanguagesService, { useValue: languagesService })
- .overrideProvider(UIService, { useValue: uiService })
- .compileComponents();
- fixture = TestBed.createComponent(SingleArticleComponent);
- component = fixture.componentInstance;
- }));
- it('should be defined', () => {
- expect(component).toBeDefined();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement