123456789101112131415161718192021222324252627282930 |
- import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
- import { PageCompanionComponent } from './page-companion.component';
- describe('PageCompanionComponent', () => {
- let component: PageCompanionComponent;
- let fixture: ComponentFixture<PageCompanionComponent>;
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [PageCompanionComponent],
-
- }).compileComponents();
- fixture = TestBed.createComponent(PageCompanionComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- }));
- it('should create', () => {
- expect(component).toBeTruthy();
- });
- it('should add user message to messages array', () => {
- component.userInput = 'Hello, I need help';
- component.sendMessage();
- expect(component.messages.length).toBe(1);
- expect(component.messages[0].role).toBe('user');
- });
- });
|