import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AbstractExpenseIncomeDetailComponent } from './abstract-expense-income-detail.component';

describe('AbstractExpenseIncomeDetailComponent', () => {
  const RED_VAR_TEXT = 'var(--mw-red)';
  const GREEN_VAR_TEXT = 'var(--mw-green)'
  let component: AbstractExpenseIncomeDetailComponent;
  let fixture: ComponentFixture<AbstractExpenseIncomeDetailComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [AbstractExpenseIncomeDetailComponent]
    })
    .compileComponents();
    
    fixture = TestBed.createComponent(AbstractExpenseIncomeDetailComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  describe('amount text color ', () => {
    it('should be green for income variant', () => {
      fixture.componentRef.setInput('variant', 'income');
      expect(component.amountProps().color).toBe(GREEN_VAR_TEXT);
    });

    it('should be red for expense variant', () => {
      fixture.componentRef.setInput('variant', 'expense');
      expect(component.amountProps().color).toBe(RED_VAR_TEXT);
    })
  })
});
