2020-10-09 13:32:53 +00:00
|
|
|
import { Test } from '@nestjs/testing';
|
|
|
|
|
|
|
|
import { AppService } from './app.service';
|
2020-10-09 16:21:21 +00:00
|
|
|
import { Message } from '@chat-room/api-interfaces';
|
2020-10-09 13:32:53 +00:00
|
|
|
|
|
|
|
describe('AppService', () => {
|
|
|
|
let service: AppService;
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
const app = await Test.createTestingModule({
|
|
|
|
providers: [AppService],
|
|
|
|
}).compile();
|
|
|
|
|
|
|
|
service = app.get<AppService>(AppService);
|
|
|
|
});
|
|
|
|
|
2020-10-09 16:21:21 +00:00
|
|
|
describe('addMessage', () => {
|
|
|
|
it('should return message', () => {
|
|
|
|
const message: Message = {
|
|
|
|
creationDate: new Date().toISOString(),
|
|
|
|
message: 'Test message',
|
|
|
|
user: 'Test User',
|
|
|
|
color: 'Test color',
|
|
|
|
};
|
|
|
|
expect(service.addMessage(message)).toBe(message);
|
2020-10-09 13:32:53 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|