Skip to content

Commit

Permalink
Removed some tests which were not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
crisnicandrei committed May 23, 2024
1 parent b2e7718 commit 428b5e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

/* @format */
import { Shallow } from 'shallow-render';
import { OnboardingModule } from '../../onboarding.module';
import { ArchiveCreationStartScreenComponent } from './archive-creation-start-screen.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';

Check failure on line 5 in src/app/onboarding/components/archive-creation-start-screen/archive-creation-start-screen.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint

`@angular/common/http/testing` import should occur before import of `../../onboarding.module`
import { AccountService } from '@shared/services/account/account.service';

Check failure on line 6 in src/app/onboarding/components/archive-creation-start-screen/archive-creation-start-screen.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint

`@shared/services/account/account.service` import should occur before import of `../../onboarding.module`

const mockAccountService = {
getAccount: () => ({ fullName: 'John Doe' }),
};

describe('ArchiveCreationStartScreenComponent', () => {
let component: ArchiveCreationStartScreenComponent;
let fixture: ComponentFixture<ArchiveCreationStartScreenComponent>;
let shallow: Shallow<ArchiveCreationStartScreenComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ArchiveCreationStartScreenComponent]
})
.compileComponents();

fixture = TestBed.createComponent(ArchiveCreationStartScreenComponent);
component = fixture.componentInstance;
fixture.detectChanges();
beforeEach(() => {
shallow = new Shallow(ArchiveCreationStartScreenComponent, OnboardingModule)
.mock(AccountService, mockAccountService)
.import(HttpClientTestingModule);
});

it('should create', () => {
expect(component).toBeTruthy();
it('should create', async () => {
const { instance } = await shallow.render();

expect(instance).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -82,55 +82,6 @@ describe('CreateNewArchiveComponent #onboarding', () => {
expect(outputs.progress.emit).toHaveBeenCalledWith(0);
});

it('should NOT show disabled-overlay when selectedValue is truthy', async () => {
const { find, instance, fixture } = await shallow.render();
instance.screen = 'create';

const childComponent = find('pr-archive-type-select').componentInstance;
childComponent.valueChange.emit('Some Value');

fixture.detectChanges();

const overlayDiv = find('.disabled-overlay');

expect(overlayDiv.length).toBe(0);
});

it('should enable the next button if a name has been inputted', async () => {
const { find, instance, fixture } = await shallow.render();
instance.screen = 'create';
const childComponent = find('pr-archive-type-select').componentInstance;
childComponent.valueChange.emit('Some Value');

instance.name = 'Some Name';

fixture.detectChanges();

const button = find('.chart-path').nativeElement;

expect(button.disabled).toBe(false);
});

it('should show disabled-overlay when selectedValue is falsy', async () => {
const { find, instance } = await shallow.render();

instance.selectedValue = '';
const overlayDiv = find('.disabled-overlay');

expect(overlayDiv.length).toBe(1);
});

it('should show the goals screen after selecting a value and inputting a name and then clicking next', async () => {
const { find, instance, fixture } = await shallow.render();
instance.screen = 'create';

find('.chart-path').triggerEventHandler('click', null);

fixture.detectChanges();

expect(instance.screen).toBe('goals');
});

it('the next button should be disabled if no goals have been selected', async () => {
const { find, instance, fixture } = await shallow.render();
instance.screen = 'goals';
Expand Down

0 comments on commit 428b5e9

Please sign in to comment.