-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cb2-13667): capitalise cert numbers for iva/msva (#1590)
* feat(cb2-13667): capitalise all letters in iva/msva cert number * feat(cb2-13667): reorder spec group 1 test type ids for better readability * feat(cb2-13667): capitalise amend cert numb and handle legacy lowercase certs --------- Co-authored-by: Thomas Crawley <[email protected]>
- Loading branch information
1 parent
d35ffd4
commit d86db95
Showing
10 changed files
with
110 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 36 additions & 23 deletions
59
src/app/forms/components/text-input/__tests__/text-input.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,52 @@ | ||
import { Component } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { FormGroup } from '@angular/forms'; | ||
import { CustomFormControl, FormNodeTypes } from '@services/dynamic-forms/dynamic-form.types'; | ||
import { FormsModule, NgControl, Validators } from '@angular/forms'; | ||
import { FieldErrorMessageComponent } from '@forms/components/field-error-message/field-error-message.component'; | ||
import { CustomFormControl, FormNodeTypes, FormNodeValueFormat } from '@services/dynamic-forms/dynamic-form.types'; | ||
import { TextInputComponent } from '../text-input.component'; | ||
|
||
@Component({ | ||
selector: 'app-host-component', | ||
template: `<form [formGroup]="form"> | ||
<app-text-input name="foo" formControlName="foo"></app-text-input> | ||
</form> `, | ||
styles: [], | ||
}) | ||
class HostComponent { | ||
form = new FormGroup({ | ||
foo: new CustomFormControl({ name: 'foo', type: FormNodeTypes.CONTROL, children: [] }, ''), | ||
}); | ||
} | ||
|
||
describe('TextInputComponent', () => { | ||
let component: HostComponent; | ||
let fixture: ComponentFixture<HostComponent>; | ||
let component: TextInputComponent; | ||
let fixture: ComponentFixture<TextInputComponent>; | ||
const metadata = { | ||
name: 'foo', | ||
type: FormNodeTypes.CONTROL, | ||
children: [], | ||
valueFormat: FormNodeValueFormat.UPPERCASE, | ||
}; | ||
|
||
beforeEach(async () => { | ||
const NG_CONTROL_PROVIDER = { | ||
provide: NgControl, | ||
useClass: class extends NgControl { | ||
control = new CustomFormControl(metadata, '', [Validators.required]); | ||
viewToModelUpdate() {} | ||
}, | ||
}; | ||
|
||
await TestBed.configureTestingModule({ | ||
declarations: [TextInputComponent], | ||
}).compileComponents(); | ||
}); | ||
declarations: [TextInputComponent, FieldErrorMessageComponent], | ||
imports: [FormsModule], | ||
}) | ||
.overrideComponent(TextInputComponent, { add: { providers: [NG_CONTROL_PROVIDER] } }) | ||
.compileComponents(); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(HostComponent); | ||
fixture = TestBed.createComponent(TextInputComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
describe('handleChange', () => { | ||
it('should call the formatString method if the value is a string', () => { | ||
const formatString = jest.spyOn(component, 'formatString'); | ||
const onChange = jest.spyOn(component, 'onChange'); | ||
component.handleChange('string'); | ||
expect(formatString).toHaveBeenCalled(); | ||
expect(onChange).toHaveBeenCalledWith('STRING'); | ||
expect(component.value).toBe('STRING'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters