Skip to content

Commit

Permalink
Fixed error in test console from tanks size
Browse files Browse the repository at this point in the history
  • Loading branch information
jirkapok committed Nov 20, 2024
1 parent 11ceb39 commit 3652aaa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 0 additions & 1 deletion doc/missingTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

* GasBlenderComponent
* Diver.component.ts: Add tests for rmv and stressRmv save and load
* Fix TankSizeComponent line 56 error in the tests console
* Options component:
* switchAirBreaks
* useRecreational
Expand Down
18 changes: 11 additions & 7 deletions projects/planner/src/app/tank.size/tank.size.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ReactiveFormsModule } from '@angular/forms';
import { TankSizeComponent } from './tank.size.component';
import { UnitConversion } from '../shared/UnitConversion';
import { InputControls } from '../shared/inputcontrols';
Expand All @@ -8,6 +8,7 @@ import { ValidatorGroups } from '../shared/ValidatorGroups';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';


export class TankSizePage {
constructor(private fixture: ComponentFixture<TankSizeComponent>) { }

Expand All @@ -26,20 +27,24 @@ describe('TankSizeComponent', () => {
let fixture: ComponentFixture<TankSizeComponent>;
let page: TankSizePage;

beforeEach(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [TankSizeComponent],
providers: [UnitConversion, InputControls, DecimalPipe, ValidatorGroups]
});
providers: [UnitConversion, InputControls, DecimalPipe, ValidatorGroups],
imports: [ReactiveFormsModule]
}).compileComponents();
});

beforeEach(() => {
const units = TestBed.inject(UnitConversion);
units.imperialUnits = true;
fixture = TestBed.createComponent(TankSizeComponent);
component = fixture.componentInstance;
page = new TankSizePage(fixture);
fixture.detectChanges();
});

it('Changing size applies the value', () => {
fixture.detectChanges();
spyOn(component.sizeChange, 'emit');
const sizeField = page.sizeInput;
sizeField.value = '12';
Expand All @@ -60,7 +65,6 @@ describe('TankSizeComponent', () => {
});

it('Assign standard tank applies impoerial values', () => {
fixture.detectChanges();
spyOn(component.applyTemplate, 'emit');
const templateButtons = page.templateButtons[2].nativeElement as HTMLInputElement;
templateButtons.dispatchEvent(new Event('click'));
Expand Down

0 comments on commit 3652aaa

Please sign in to comment.