Skip to content

Commit

Permalink
[ACS-6211] Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil-verma-gl committed Nov 27, 2023
1 parent 760a575 commit 5ca8d72
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@ describe('RuleActionUiComponent', () => {
component.parameterConstraints = dummyConstraints;
fixture.detectChanges();

const cardView = getByDataAutomationId('rule-action-card-view').componentInstance as CardViewComponent;
expect(cardView.properties.length).toBe(0);

changeMatSelectValue('rule-action-select', 'mock-action-1-definition');

const cardView = getByDataAutomationId('rule-action-card-view').componentInstance as CardViewComponent;

expect(cardView.properties.length).toBe(5);
expect(cardView.properties[0]).toBeInstanceOf(CardViewTextItemModel);
expect(cardView.properties[1]).toBeInstanceOf(CardViewBoolItemModel);
Expand All @@ -87,19 +86,19 @@ describe('RuleActionUiComponent', () => {
expect(cardView.properties[4]).toBeInstanceOf(CardViewSelectItemModel);

changeMatSelectValue('rule-action-select', 'mock-action-2-definition');
expect(cardView.properties.length).toBe(0);
expect(getByDataAutomationId('rule-action-card-view')).toBeNull();
});

it('should create category-value action parameter as a text box rather than node picker', () => {
component.actionDefinitions = [actionLinkToCategoryTransformedMock];
component.parameterConstraints = dummyConstraints;
fixture.detectChanges();

const cardView = getByDataAutomationId('rule-action-card-view').componentInstance as CardViewComponent;
expect(cardView.properties.length).toBe(0);

changeMatSelectValue('rule-action-select', 'mock-action-3-definition');

const cardView = getByDataAutomationId('rule-action-card-view').componentInstance as CardViewComponent;

expect(cardView.properties.length).toBe(1);
expect(cardView.properties[0].icon).toBeFalsy();
expect(cardView.properties[0].value).toBeFalsy();
expect(cardView.properties[0]).toBeInstanceOf(CardViewTextItemModel);
Expand Down

0 comments on commit 5ca8d72

Please sign in to comment.