-<div class="container">
+<div class="container header">
<header class="d-flex flex-wrap justify-content-center pt-3 pb-2 mb-4 border-bottom">
<a href="/" class="d-flex align-items-center mb-2 mb-md-0 me-md-auto text-dark text-decoration-none">
<svg class="bi me-2" width="70" height="50"><use xlink:href="#juplo"/></svg>
</ul>
</header>
</div>
-<div class="container">
+<div class="container content">
<router-outlet></router-outlet>
</div> <!-- /container -->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
expect(app).toBeTruthy();
});
- it(`should have as title 'chatroom-frontend'`, () => {
+ it('should render the header', () => {
const fixture = TestBed.createComponent(AppComponent);
- const app = fixture.componentInstance;
- expect(app.title).toEqual('chatroom-frontend');
+ fixture.detectChanges();
+ const compiled = fixture.nativeElement as HTMLElement;
+ expect(compiled.querySelector('div.header')).toBeDefined();
});
- it('should render title', () => {
+ it('should render the content', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
- expect(compiled.querySelector('.content span')?.textContent).toContain('chatroom-frontend app is running!');
+ expect(compiled.querySelector('div.content')).toBeDefined();
});
});
styleUrls: ['./app.component.less']
})
export class AppComponent {
- title = 'Chatroom';
+ title = 'chatroom-frontend';
}
+import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { RouterTestingModule } from '@angular/router/testing';
import { ChatroomComponent } from './chatroom.component';
describe('ChatroomComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
+ imports: [
+ HttpClientTestingModule,
+ RouterTestingModule,
+ ],
declarations: [ ChatroomComponent ]
})
.compileComponents();
+import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
-
+import { RouterTestingModule } from '@angular/router/testing';
import { ChatroomService } from './chatroom.service';
describe('ChatroomService', () => {
let service: ChatroomService;
beforeEach(() => {
- TestBed.configureTestingModule({});
+ TestBed.configureTestingModule({
+ imports: [
+ HttpClientTestingModule,
+ RouterTestingModule,
+ ],
+ });
service = TestBed.inject(ChatroomService);
});
+import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-
import { ChatroomsComponent } from './chatrooms.component';
describe('ChatroomsComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
+ imports: [ HttpClientTestingModule ],
declarations: [ ChatroomsComponent ]
})
.compileComponents();
import { ComponentFixture, TestBed } from '@angular/core/testing';
-
+import { ReactiveFormsModule } from '@angular/forms';
import { UserComponent } from './user.component';
describe('UserComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
+ imports: [ ReactiveFormsModule ],
declarations: [ UserComponent ]
})
.compileComponents();
fixture.detectChanges();
});
- it('should create', () => {
+ it('should be create', () => {
expect(component).toBeTruthy();
});
});