This repository was archived by the owner on Nov 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread-idea.component.spec.ts
More file actions
70 lines (61 loc) · 2.05 KB
/
read-idea.component.spec.ts
File metadata and controls
70 lines (61 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ActivatedRoute } from '@angular/router';
import { Component, Input } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { ReadIdeaComponent } from './read-idea.component';
import { EditorOutputComponent } from 'app/shared/editor-output/editor-output.component';
import { MaterialModule } from 'app/material.module';
import { AuthService } from 'app/auth.service';
import { ModelService } from 'app/model.service';
import { UserSmallStubComponent } from 'app/shared/user-small/user-small.component';
import { CommentsStubComponent } from 'app/comments/comments.component';
import { VoteStubComponent } from 'app/shared/vote/vote.component';
@Component({ selector: 'app-tag-list', template: '' })
class TagListStubComponent {
@Input() tags;
}
class AuthStubService {
username = 'user';
}
class ModelStubService { }
class ActivatedRouteStub {
data = Observable.of({
idea: { id: '123', creator: { username: 'user' } },
ideaTags: []
});
}
describe('ReadIdeaComponent', () => {
let component: ReadIdeaComponent;
let fixture: ComponentFixture<ReadIdeaComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
CommentsStubComponent,
EditorOutputComponent,
ReadIdeaComponent,
TagListStubComponent,
UserSmallStubComponent,
VoteStubComponent
],
imports: [
MaterialModule,
RouterTestingModule
],
providers: [
{ provide: AuthService, useClass: AuthStubService },
{ provide: ActivatedRoute, useClass: ActivatedRouteStub },
{ provide: ModelService, useClass: ModelStubService }
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReadIdeaComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});