Testing

Unit Tests

Run unit tests via Karma:

npm test

Tests are written using Jasmine and located alongside components:

End-to-End Tests

Run e2e tests via Protractor:

npm run e2e

E2E tests are located in the e2e/ directory.

Test Configuration

Writing Tests

Example component test:

describe('CartComponent', () => {
  let component: CartComponent;
  let fixture: ComponentFixture<CartComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [ CartComponent ]
    }).compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(CartComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

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

  it('should load cart items', () => {
    component.loadCart();
    expect(component.cartItems.length).toBeGreaterThan(0);
  });
});

Revision #1
Created 24 February 2026 07:26:46 by ondeliveloper
Updated 24 February 2026 07:27:07 by ondeliveloper