From 0b9eb18798c038d4bc7a0d982d659cc1508eb2fc Mon Sep 17 00:00:00 2001 From: lucasferreiralimax Date: Mon, 21 Oct 2024 20:19:16 -0300 Subject: [PATCH] test(unit): clean spec components from nucleus-angular --- src/app/app.component.spec.ts | 48 +---------------------------------- 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 2b4de3f..0cc0706 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,10 +1,5 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { DarkmodeComponent } from 'darkmode-angular'; -import { FormsModule } from '@angular/forms'; import { AppComponent } from './app.component'; -import { AppHeaderComponent } from './components/app-header/app-header.component'; -import { ModalinstallComponent } from './components/modal-install/modal-install.component'; -import { AppFooterComponent } from './components/app-footer/app-footer.component'; import { UpWindowAngularModule } from '../../projects/up-window-angular/src/public-api'; import { By } from '@angular/platform-browser'; @@ -14,15 +9,7 @@ describe('AppComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - FormsModule, - AppComponent, - DarkmodeComponent, - AppHeaderComponent, - ModalinstallComponent, - UpWindowAngularModule, - AppFooterComponent - ], + imports: [AppComponent, UpWindowAngularModule], }).compileComponents(); })); @@ -36,41 +23,8 @@ describe('AppComponent', () => { expect(component).toBeTruthy(); }); - it('should render app-darkmode component with hiddenLabel true', () => { - const darkModeComponent = fixture.debugElement.query(By.directive(DarkmodeComponent)); - expect(darkModeComponent).toBeTruthy(); - expect(darkModeComponent.componentInstance.hiddenLabel).toBe(true); - }); - - it('should render app-header component', () => { - const headerComponent = fixture.debugElement.query(By.directive(AppHeaderComponent)); - expect(headerComponent).toBeTruthy(); - }); - it('should render main with class main', () => { const mainElement = fixture.debugElement.query(By.css('main.main')); expect(mainElement).toBeTruthy(); }); - - it('should render app-modal-install component with correct properties', () => { - component.isModalActive = true; - fixture.detectChanges(); - const modalComponent = fixture.debugElement.query(By.directive(ModalinstallComponent)); - expect(modalComponent).toBeTruthy(); - expect(modalComponent.componentInstance.active).toBe(true); - }); - - it('should call openModal when button with class button-modal is clicked', () => { - spyOn(component, 'openModal'); - const buttonElement = fixture.debugElement.query(By.css('.button-modal')); - buttonElement.nativeElement.click(); - expect(component.openModal).toHaveBeenCalled(); - }); - - it('should render correct codeString in code-wrapper element', () => { - component.codeString = 'npm install up-window-angular'; - fixture.detectChanges(); - const codeWrapperElement = fixture.debugElement.query(By.css('.code-wrapper')); - expect(codeWrapperElement.nativeElement.textContent.trim()).toBe('npm install up-window-angular'); - }); });