Skip to content

Commit

Permalink
fixing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Snehasish authored and Snehasish committed Jan 12, 2025
1 parent d826ac6 commit 5a36390
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,47 +481,49 @@ describe('FyCurrencyComponent', () => {
expect(component.valid).toBeTrue();
});

it('should set autoCodeMessage to "Currency and Amount are auto coded." when both are auto coded', () => {
it('should set currencyAutoCodeMessage to "Currency is auto coded." and amountAutoCodeMessage to "Amount is auto coded." when both are auto coded', () => {
component.autoCodedData = { currency: 'USD', amount: 100 };
component.fg = new FormGroup({
currency: new FormControl('USD'),
amount: new FormControl(100),
homeCurrencyAmount: new FormControl(null),
});
component.showAutoCodeMessage();
expect(component.autoCodeMessage).toBe('Currency and Amount are auto coded.');
expect(component.currencyAutoCodeMessage).toBe('Currency is auto coded.');
expect(component.amountAutoCodeMessage).toBe('Amount is auto coded.');
});

it('should set autoCodeMessage to "Currency is auto coded." when only currency is auto coded', () => {
it('should set currencyAutoCodeMessage to "Currency is auto coded." when only currency is auto coded', () => {
component.autoCodedData = { currency: 'USD', amount: 100 };
component.fg = new FormGroup({
currency: new FormControl('USD'),
amount: new FormControl(200),
homeCurrencyAmount: new FormControl(null),
});
component.showAutoCodeMessage();
expect(component.autoCodeMessage).toBe('Currency is auto coded.');
expect(component.currencyAutoCodeMessage).toBe('Currency is auto coded.');
});

it('should set autoCodeMessage to "Amount is auto coded." when only amount is auto coded', () => {
it('should set amountAutoCodeMessage to "Amount is auto coded." when only amount is auto coded', () => {
component.autoCodedData = { currency: 'USD', amount: 100 };
component.fg = new FormGroup({
currency: new FormControl('EUR'),
amount: new FormControl(100),
homeCurrencyAmount: new FormControl(null),
});
component.showAutoCodeMessage();
expect(component.autoCodeMessage).toBe('Amount is auto coded.');
expect(component.amountAutoCodeMessage).toBe('Amount is auto coded.');
});

it('should set autoCodeMessage to "" when neither currency nor amount is auto coded', () => {
it('should set currencyAutoCodeMessage and amountAutoCodeMessage to "" when neither currency nor amount is auto coded', () => {
component.autoCodedData = { currency: 'USD', amount: 100 };
component.fg = new FormGroup({
currency: new FormControl('EUR'),
amount: new FormControl(200),
homeCurrencyAmount: new FormControl(null),
});
component.showAutoCodeMessage();
expect(component.autoCodeMessage).toBe('');
expect(component.currencyAutoCodeMessage).toBe('');
expect(component.amountAutoCodeMessage).toBe('');
});
});

0 comments on commit 5a36390

Please sign in to comment.