import { AlertComponent } from './alert.component'; import { Alert, AlertType } from '@core/modules/cart/models/alert.interface'; export const ui = 60; export const accessibility = null; describe('Cart 2.0', () => { describe('AlertComponent', () => { let alertComponent: AlertComponent; beforeEach(() => { alertComponent = new AlertComponent(); }); it('should have AlertComponent defined', () => { expect(alertComponent).toBeTruthy(); }); it('should have input `alerts` value as `Undefined`', () => { expect(alertComponent.alerts).toBeUndefined(); }); it('should have removeAlertById method created', () => { expect(alertComponent.removeAlertById).toBeTruthy(); }); describe('cssClass', () => { it('should have cssClass method created', () => { expect(alertComponent.cssClass).toBeTruthy(); }); it('should have state with empty object when type is Success', () => { const alertMock: Alert = { id: 'testID', type: AlertType.Success, message: 'test message', messageList: [], dismissible: false }; expect(alertComponent.cssClass(alertMock)).toEqual('hdca-alert--is-success'); }); it('should have state with empty object when type is Error', () => { const alertMock: Alert = { id: 'testID', type: AlertType.Error, message: 'test message', messageList: [], dismissible: false }; expect(alertComponent.cssClass(alertMock)).toEqual('hdca-alert--is-error'); }); it('should have state with empty object when type is Info', () => { const alertMock: Alert = { id: 'testID', type: AlertType.Info, message: 'test message', messageList: [], dismissible: false }; expect(alertComponent.cssClass(alertMock)).toEqual('hdca-alert--is-info hdca-alert--is-subtle'); }); it('should have state with empty object when type is Warning', () => { const alertMock: Alert = { id: 'testID', type: AlertType.Warning, message: 'test message', messageList: [], dismissible: false }; expect(alertComponent.cssClass(alertMock)).toEqual('hdca-alert--is-warning'); }); it('should have state with empty object when type is Savings', () => { const alertMock: Alert = { id: 'testID', type: AlertType.Savings, message: 'test message', messageList: [], dismissible: false }; expect(alertComponent.cssClass(alertMock)).toEqual('hdca-alert--is-savings hdca-alert--is-compact hdca-alert--is-subtle'); }); }); }); });