Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
Changed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Migarve55 committed Apr 22, 2019
1 parent dedd125 commit f13d70a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/message/message.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ChatService } from '../services/chat.service';
import { ToastrModule } from 'ngx-toastr';
import {By} from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ChatMessage } from '../models/chat-message.model';

describe('MessageComponent', () => {
let component: MessageComponent;
Expand All @@ -22,24 +23,24 @@ describe('MessageComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(MessageComponent);
component = fixture.componentInstance;
component.chatMessage = new ChatMessage("Test 1", "Test msg", new Date());
component.chatMessage.webId = "";
fixture.detectChanges();
});

it('should be created', () => {
expect(component).toBeTruthy();
});

it('should remove message (case a)', () => {
component.messageContent = '';
it('should not remove a message that is not yours', () => {
component.isOwnMessage = false;
component.removeMessage();
expect(By.css('#toastr-container'));
});

it('should remove message (case b)', () => {
component.messageContent = 'a';
it('should remove message', () => {
component.isOwnMessage = true;
component.removeMessage();
expect(By.css('#toastr-container'));
expect(component.messageContent === '');
expect(!By.css('#toastr-container'));
});
});

0 comments on commit f13d70a

Please sign in to comment.