[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M781Y5EMT10XA2QR9589JTMF":3,"skill-same:01M781Y5EMT10XA2QR9589JTMF":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M781Y5EMT10XA2QR9589JTMF","angular-testing",null,"Write unit and integration tests for Angular v20+ applications using Vitest or Jasmine with TestBed and modern testing patterns. Use for testing components with signals, OnPush change detection, services with inject(), and HTTP interactions. Triggers on test creation, testing signal-based components, mocking dependencies, or setting up test infrastructure. Don't use for E2E testing with Cypress or Playwright, or for testing non-Angular JavaScript\u002FTypeScript code.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_analogjs_angular-skills_angular-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: angular-testing\ndescription: Write unit and integration tests for Angular v20+ applications using Vitest or Jasmine with TestBed and modern testing patterns. Use for testing components with signals, OnPush change detection, services with inject(), and HTTP interactions. Triggers on test creation, testing signal-based components, mocking dependencies, or setting up test infrastructure. Don't use for E2E testing with Cypress or Playwright, or for testing non-Angular JavaScript\u002FTypeScript code.\n---\n\n# Angular Testing\n\nTest Angular v20+ applications with Vitest (recommended) or Jasmine, focusing on signal-based components and modern patterns.\n\n## Vitest Setup (Angular v20+)\n\nAngular v20+ has native Vitest support through the `@angular\u002Fbuild` package.\n\n```bash\nnpm install -D vitest jsdom\n```\n\nConfigure in angular.json:\n\n```json\n{\n  \"projects\": {\n    \"your-app\": {\n      \"architect\": {\n        \"test\": {\n          \"builder\": \"@angular\u002Fbuild:unit-test\",\n          \"options\": {\n            \"tsConfig\": \"tsconfig.spec.json\",\n            \"buildTarget\": \"your-app:build\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRun tests:\n\n```bash\nng test              # Run tests\nng test --watch      # Watch mode\nng test --code-coverage  # With coverage\n```\n\nFor Vitest migration from Jasmine and advanced configuration, see [references\u002Fvitest-migration.md](references\u002Fvitest-migration.md).\n\n## Basic Component Test\n\n```typescript\nimport { describe, it, expect, beforeEach } from 'vitest';\nimport { ComponentFixture, TestBed } from '@angular\u002Fcore\u002Ftesting';\nimport { Counter } from '.\u002Fcounter.component';\n\ndescribe('Counter', () => {\n  let component: Counter;\n  let fixture: ComponentFixture\u003CCounter>;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [Counter], \u002F\u002F Standalone component\n    }).compileComponents();\n    \n    fixture = TestBed.createComponent(Counter);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n  \n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n  \n  it('should increment count', () => {\n    expect(component.count()).toBe(0);\n    component.increment();\n    expect(component.count()).toBe(1);\n  });\n  \n  it('should display count in template', () => {\n    component.count.set(5);\n    fixture.detectChanges();\n    \n    const element = fixture.nativeElement.querySelector('.count');\n    expect(element.textContent).toContain('5');\n  });\n});\n```\n\n## Testing Signals\n\n### Direct Signal Testing\n\n```typescript\nimport { signal, computed } from '@angular\u002Fcore';\n\ndescribe('Signal logic', () => {\n  it('should update computed when signal changes', () => {\n    const count = signal(0);\n    const doubled = computed(() => count() * 2);\n    \n    expect(doubled()).toBe(0);\n    \n    count.set(5);\n    expect(doubled()).toBe(10);\n    \n    count.update(c => c + 1);\n    expect(doubled()).toBe(12);\n  });\n});\n```\n\n### Testing Component Signals\n\n```typescript\n@Component({\n  selector: 'app-todo-list',\n  template: `\n    \u003Cul>\n      @for (todo of filteredTodos(); track todo.id) {\n        \u003Cli>{{ todo.text }}\u003C\u002Fli>\n      }\n    \u003C\u002Ful>\n    \u003Cp>{{ remaining() }} remaining\u003C\u002Fp>\n  `,\n})\nexport class TodoList {\n  todos = signal\u003CTodo[]>([]);\n  filter = signal\u003C'all' | 'active' | 'done'>('all');\n  \n  filteredTodos = computed(() => {\n    const todos = this.todos();\n    switch (this.filter()) {\n      case 'active': return todos.filter(t => !t.done);\n      case 'done': return todos.filter(t => t.done);\n      default: return todos;\n    }\n  });\n  \n  remaining = computed(() => this.todos().filter(t => !t.done).length);\n}\n\ndescribe('TodoList', () => {\n  let component: TodoList;\n  let fixture: ComponentFixture\u003CTodoList>;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [TodoList],\n    }).compileComponents();\n    \n    fixture = TestBed.createComponent(TodoList);\n    component = fixture.componentInstance;\n  });\n  \n  it('should filter active todos', () => {\n    component.todos.set([\n      { id: '1', text: 'Task 1', done: false },\n      { id: '2', text: 'Task 2', done: true },\n      { id: '3', text: 'Task 3', done: false },\n    ]);\n    \n    component.filter.set('active');\n    \n    expect(component.filteredTodos().length).toBe(2);\n    expect(component.remaining()).toBe(2);\n  });\n});\n```\n\n## Testing OnPush Components\n\nOnPush components require explicit change detection:\n\n```typescript\n@Component({\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  template: `\u003Cspan>{{ data().name }}\u003C\u002Fspan>`,\n})\nexport class OnPushCmpt {\n  data = input.required\u003C{ name: string }>();\n}\n\ndescribe('OnPushCmpt', () => {\n  it('should update when input signal changes', () => {\n    const fixture = TestBed.createComponent(OnPushCmpt);\n    \n    \u002F\u002F Set input using setInput (for signal inputs)\n    fixture.componentRef.setInput('data', { name: 'Initial' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Initial');\n    \n    \u002F\u002F Update input\n    fixture.componentRef.setInput('data', { name: 'Updated' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Updated');\n  });\n});\n```\n\n## Testing Services\n\n### Basic Service Test\n\n```typescript\n@Injectable({ providedIn: 'root' })\nexport class CounterService {\n  private _count = signal(0);\n  readonly count = this._count.asReadonly();\n  \n  increment() { this._count.update(c => c + 1); }\n  reset() { this._count.set(0); }\n}\n\ndescribe('CounterService', () => {\n  let service: CounterService;\n  \n  beforeEach(() => {\n    TestBed.configureTestingModule({});\n    service = TestBed.inject(CounterService);\n  });\n  \n  it('should increment count', () => {\n    expect(service.count()).toBe(0);\n    service.increment();\n    expect(service.count()).toBe(1);\n  });\n});\n```\n\n### Service with HTTP\n\n```typescript\nimport { HttpTestingController, provideHttpClientTesting } from '@angular\u002Fcommon\u002Fhttp\u002Ftesting';\nimport { provideHttpClient } from '@angular\u002Fcommon\u002Fhttp';\n\ndescribe('UserService', () => {\n  let service: UserService;\n  let httpMock: HttpTestingController;\n  \n  beforeEach(() => {\n    TestBed.configureTestingModule({\n      providers: [\n        provideHttpClient(),\n        provideHttpClientTesting(),\n      ],\n    });\n    \n    service = TestBed.inject(UserService);\n    httpMock = TestBed.inject(HttpTestingController);\n  });\n  \n  afterEach(() => {\n    httpMock.verify(); \u002F\u002F Verify no outstanding requests\n  });\n  \n  it('should fetch user by id', () => {\n    const mockUser = { id: '1', name: 'Test User' };\n    \n    service.getUser('1').subscribe(user => {\n      expect(user).toEqual(mockUser);\n    });\n    \n    const req = httpMock.expectOne('\u002Fapi\u002Fusers\u002F1');\n    expect(req.request.method).toBe('GET');\n    req.flush(mockUser);\n  });\n});\n```\n\n## Mocking Dependencies\n\n### Using Vitest Mocks\n\n```typescript\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\n\ndescribe('UserProfile', () => {\n  const mockUserService = {\n    getUser: vi.fn(),\n    updateUser: vi.fn(),\n    user: signal\u003CUser | null>(null),\n  };\n  \n  beforeEach(async () => {\n    vi.clearAllMocks();\n    mockUserService.getUser.mockReturnValue(of({ id: '1', name: 'Test' }));\n    \n    await TestBed.configureTestingModule({\n      imports: [UserProfile],\n      providers: [\n        { provide: UserService, useValue: mockUserService },\n      ],\n    }).compileComponents();\n  });\n  \n  it('should call getUser on init', () => {\n    const fixture = TestBed.createComponent(UserProfile);\n    fixture.detectChanges();\n    \n    expect(mockUserService.getUser).toHaveBeenCalledWith('1');\n  });\n});\n```\n\n### Mock Signal-Based Service\n\n```typescript\nconst mockAuth = {\n  user: signal\u003CUser | null>(null),\n  isAuthenticated: computed(() => mockAuth.user() !== null),\n  login: vi.fn(),\n  logout: vi.fn(),\n};\n\nbeforeEach(async () => {\n  await TestBed.configureTestingModule({\n    imports: [ProtectedPage],\n    providers: [\n      { provide: AuthService, useValue: mockAuth },\n    ],\n  }).compileComponents();\n});\n\nit('should show content when authenticated', () => {\n  mockAuth.user.set({ id: '1', name: 'Test User' });\n  \n  const fixture = TestBed.createComponent(ProtectedPage);\n  fixture.detectChanges();\n  \n  expect(fixture.nativeElement.querySelector('.protected-content')).toBeTruthy();\n});\n```\n\n## Testing Inputs and Outputs\n\n```typescript\n@Component({\n  selector: 'app-item',\n  template: `\u003Cdiv (click)=\"select()\">{{ item().name }}\u003C\u002Fdiv>`,\n})\nexport class ItemCmpt {\n  item = input.required\u003CItem>();\n  selected = output\u003CItem>();\n  \n  select() {\n    this.selected.emit(this.item());\n  }\n}\n\ndescribe('ItemCmpt', () => {\n  it('should emit selected event on click', () => {\n    const fixture = TestBed.createComponent(ItemCmpt);\n    const item: Item = { id: '1', name: 'Test Item' };\n    \n    fixture.componentRef.setInput('item', item);\n    fixture.detectChanges();\n    \n    let emittedItem: Item | undefined;\n    fixture.componentInstance.selected.subscribe(i => emittedItem = i);\n    \n    fixture.nativeElement.querySelector('div').click();\n    \n    expect(emittedItem).toEqual(item);\n  });\n});\n```\n\n## Testing Async Operations\n\n### Using fakeAsync\n\n```typescript\nimport { fakeAsync, tick, flush } from '@angular\u002Fcore\u002Ftesting';\n\nit('should debounce search', fakeAsync(() => {\n  const fixture = TestBed.createComponent(SearchCmpt);\n  fixture.detectChanges();\n  \n  fixture.componentInstance.query.set('test');\n  \n  tick(300); \u002F\u002F Advance time for debounce\n  fixture.detectChanges();\n  \n  expect(fixture.componentInstance.results().length).toBeGreaterThan(0);\n  \n  flush(); \u002F\u002F Flush remaining timers\n}));\n```\n\n### Using waitForAsync\n\n```typescript\nimport { waitForAsync } from '@angular\u002Fcore\u002Ftesting';\n\nit('should load data', waitForAsync(() => {\n  const fixture = TestBed.createComponent(DataCmpt);\n  fixture.detectChanges();\n  \n  fixture.whenStable().then(() => {\n    fixture.detectChanges();\n    expect(fixture.componentInstance.data()).toBeDefined();\n  });\n}));\n```\n\n## Testing HTTP Resources\n\n```typescript\n@Component({\n  template: `\n    @if (userResource.isLoading()) {\n      \u003Cp>Loading...\u003C\u002Fp>\n    } @else if (userResource.hasValue()) {\n      \u003Cp>{{ userResource.value().name }}\u003C\u002Fp>\n    }\n  `,\n})\nexport class UserCmpt {\n  userId = signal('1');\n  userResource = httpResource\u003CUser>(() => `\u002Fapi\u002Fusers\u002F${this.userId()}`);\n}\n\ndescribe('UserCmpt', () => {\n  let httpMock: HttpTestingController;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [UserCmpt],\n      providers: [\n        provideHttpClient(),\n        provideHttpClientTesting(),\n      ],\n    }).compileComponents();\n    \n    httpMock = TestBed.inject(HttpTestingController);\n  });\n  \n  it('should display user name after loading', () => {\n    const fixture = TestBed.createComponent(UserCmpt);\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Loading');\n    \n    const req = httpMock.expectOne('\u002Fapi\u002Fusers\u002F1');\n    req.flush({ id: '1', name: 'John Doe' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('John Doe');\n  });\n});\n```\n\nFor advanced testing patterns including component harnesses, router testing, form testing, and directive testing, see [references\u002Ftesting-patterns.md](references\u002Ftesting-patterns.md).\n\nFor Vitest migration from Jasmine, see [references\u002Fvitest-migration.md](references\u002Fvitest-migration.md).\n","# Angular Testing\n\nTest Angular v20+ applications with Vitest (recommended) or Jasmine, focusing on signal-based components and modern patterns.\n\n## Vitest Setup (Angular v20+)\n\nAngular v20+ has native Vitest support through the `@angular\u002Fbuild` package.\n\n```bash\nnpm install -D vitest jsdom\n```\n\nConfigure in angular.json:\n\n```json\n{\n  \"projects\": {\n    \"your-app\": {\n      \"architect\": {\n        \"test\": {\n          \"builder\": \"@angular\u002Fbuild:unit-test\",\n          \"options\": {\n            \"tsConfig\": \"tsconfig.spec.json\",\n            \"buildTarget\": \"your-app:build\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nRun tests:\n\n```bash\nng test              # Run tests\nng test --watch      # Watch mode\nng test --code-coverage  # With coverage\n```\n\nFor Vitest migration from Jasmine and advanced configuration, see [references\u002Fvitest-migration.md](references\u002Fvitest-migration.md).\n\n## Basic Component Test\n\n```typescript\nimport { describe, it, expect, beforeEach } from 'vitest';\nimport { ComponentFixture, TestBed } from '@angular\u002Fcore\u002Ftesting';\nimport { Counter } from '.\u002Fcounter.component';\n\ndescribe('Counter', () => {\n  let component: Counter;\n  let fixture: ComponentFixture\u003CCounter>;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [Counter], \u002F\u002F Standalone component\n    }).compileComponents();\n    \n    fixture = TestBed.createComponent(Counter);\n    component = fixture.componentInstance;\n    fixture.detectChanges();\n  });\n  \n  it('should create', () => {\n    expect(component).toBeTruthy();\n  });\n  \n  it('should increment count', () => {\n    expect(component.count()).toBe(0);\n    component.increment();\n    expect(component.count()).toBe(1);\n  });\n  \n  it('should display count in template', () => {\n    component.count.set(5);\n    fixture.detectChanges();\n    \n    const element = fixture.nativeElement.querySelector('.count');\n    expect(element.textContent).toContain('5');\n  });\n});\n```\n\n## Testing Signals\n\n### Direct Signal Testing\n\n```typescript\nimport { signal, computed } from '@angular\u002Fcore';\n\ndescribe('Signal logic', () => {\n  it('should update computed when signal changes', () => {\n    const count = signal(0);\n    const doubled = computed(() => count() * 2);\n    \n    expect(doubled()).toBe(0);\n    \n    count.set(5);\n    expect(doubled()).toBe(10);\n    \n    count.update(c => c + 1);\n    expect(doubled()).toBe(12);\n  });\n});\n```\n\n### Testing Component Signals\n\n```typescript\n@Component({\n  selector: 'app-todo-list',\n  template: `\n    \u003Cul>\n      @for (todo of filteredTodos(); track todo.id) {\n        \u003Cli>{{ todo.text }}\u003C\u002Fli>\n      }\n    \u003C\u002Ful>\n    \u003Cp>{{ remaining() }} remaining\u003C\u002Fp>\n  `,\n})\nexport class TodoList {\n  todos = signal\u003CTodo[]>([]);\n  filter = signal\u003C'all' | 'active' | 'done'>('all');\n  \n  filteredTodos = computed(() => {\n    const todos = this.todos();\n    switch (this.filter()) {\n      case 'active': return todos.filter(t => !t.done);\n      case 'done': return todos.filter(t => t.done);\n      default: return todos;\n    }\n  });\n  \n  remaining = computed(() => this.todos().filter(t => !t.done).length);\n}\n\ndescribe('TodoList', () => {\n  let component: TodoList;\n  let fixture: ComponentFixture\u003CTodoList>;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [TodoList],\n    }).compileComponents();\n    \n    fixture = TestBed.createComponent(TodoList);\n    component = fixture.componentInstance;\n  });\n  \n  it('should filter active todos', () => {\n    component.todos.set([\n      { id: '1', text: 'Task 1', done: false },\n      { id: '2', text: 'Task 2', done: true },\n      { id: '3', text: 'Task 3', done: false },\n    ]);\n    \n    component.filter.set('active');\n    \n    expect(component.filteredTodos().length).toBe(2);\n    expect(component.remaining()).toBe(2);\n  });\n});\n```\n\n## Testing OnPush Components\n\nOnPush components require explicit change detection:\n\n```typescript\n@Component({\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  template: `\u003Cspan>{{ data().name }}\u003C\u002Fspan>`,\n})\nexport class OnPushCmpt {\n  data = input.required\u003C{ name: string }>();\n}\n\ndescribe('OnPushCmpt', () => {\n  it('should update when input signal changes', () => {\n    const fixture = TestBed.createComponent(OnPushCmpt);\n    \n    \u002F\u002F Set input using setInput (for signal inputs)\n    fixture.componentRef.setInput('data', { name: 'Initial' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Initial');\n    \n    \u002F\u002F Update input\n    fixture.componentRef.setInput('data', { name: 'Updated' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Updated');\n  });\n});\n```\n\n## Testing Services\n\n### Basic Service Test\n\n```typescript\n@Injectable({ providedIn: 'root' })\nexport class CounterService {\n  private _count = signal(0);\n  readonly count = this._count.asReadonly();\n  \n  increment() { this._count.update(c => c + 1); }\n  reset() { this._count.set(0); }\n}\n\ndescribe('CounterService', () => {\n  let service: CounterService;\n  \n  beforeEach(() => {\n    TestBed.configureTestingModule({});\n    service = TestBed.inject(CounterService);\n  });\n  \n  it('should increment count', () => {\n    expect(service.count()).toBe(0);\n    service.increment();\n    expect(service.count()).toBe(1);\n  });\n});\n```\n\n### Service with HTTP\n\n```typescript\nimport { HttpTestingController, provideHttpClientTesting } from '@angular\u002Fcommon\u002Fhttp\u002Ftesting';\nimport { provideHttpClient } from '@angular\u002Fcommon\u002Fhttp';\n\ndescribe('UserService', () => {\n  let service: UserService;\n  let httpMock: HttpTestingController;\n  \n  beforeEach(() => {\n    TestBed.configureTestingModule({\n      providers: [\n        provideHttpClient(),\n        provideHttpClientTesting(),\n      ],\n    });\n    \n    service = TestBed.inject(UserService);\n    httpMock = TestBed.inject(HttpTestingController);\n  });\n  \n  afterEach(() => {\n    httpMock.verify(); \u002F\u002F Verify no outstanding requests\n  });\n  \n  it('should fetch user by id', () => {\n    const mockUser = { id: '1', name: 'Test User' };\n    \n    service.getUser('1').subscribe(user => {\n      expect(user).toEqual(mockUser);\n    });\n    \n    const req = httpMock.expectOne('\u002Fapi\u002Fusers\u002F1');\n    expect(req.request.method).toBe('GET');\n    req.flush(mockUser);\n  });\n});\n```\n\n## Mocking Dependencies\n\n### Using Vitest Mocks\n\n```typescript\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\n\ndescribe('UserProfile', () => {\n  const mockUserService = {\n    getUser: vi.fn(),\n    updateUser: vi.fn(),\n    user: signal\u003CUser | null>(null),\n  };\n  \n  beforeEach(async () => {\n    vi.clearAllMocks();\n    mockUserService.getUser.mockReturnValue(of({ id: '1', name: 'Test' }));\n    \n    await TestBed.configureTestingModule({\n      imports: [UserProfile],\n      providers: [\n        { provide: UserService, useValue: mockUserService },\n      ],\n    }).compileComponents();\n  });\n  \n  it('should call getUser on init', () => {\n    const fixture = TestBed.createComponent(UserProfile);\n    fixture.detectChanges();\n    \n    expect(mockUserService.getUser).toHaveBeenCalledWith('1');\n  });\n});\n```\n\n### Mock Signal-Based Service\n\n```typescript\nconst mockAuth = {\n  user: signal\u003CUser | null>(null),\n  isAuthenticated: computed(() => mockAuth.user() !== null),\n  login: vi.fn(),\n  logout: vi.fn(),\n};\n\nbeforeEach(async () => {\n  await TestBed.configureTestingModule({\n    imports: [ProtectedPage],\n    providers: [\n      { provide: AuthService, useValue: mockAuth },\n    ],\n  }).compileComponents();\n});\n\nit('should show content when authenticated', () => {\n  mockAuth.user.set({ id: '1', name: 'Test User' });\n  \n  const fixture = TestBed.createComponent(ProtectedPage);\n  fixture.detectChanges();\n  \n  expect(fixture.nativeElement.querySelector('.protected-content')).toBeTruthy();\n});\n```\n\n## Testing Inputs and Outputs\n\n```typescript\n@Component({\n  selector: 'app-item',\n  template: `\u003Cdiv (click)=\"select()\">{{ item().name }}\u003C\u002Fdiv>`,\n})\nexport class ItemCmpt {\n  item = input.required\u003CItem>();\n  selected = output\u003CItem>();\n  \n  select() {\n    this.selected.emit(this.item());\n  }\n}\n\ndescribe('ItemCmpt', () => {\n  it('should emit selected event on click', () => {\n    const fixture = TestBed.createComponent(ItemCmpt);\n    const item: Item = { id: '1', name: 'Test Item' };\n    \n    fixture.componentRef.setInput('item', item);\n    fixture.detectChanges();\n    \n    let emittedItem: Item | undefined;\n    fixture.componentInstance.selected.subscribe(i => emittedItem = i);\n    \n    fixture.nativeElement.querySelector('div').click();\n    \n    expect(emittedItem).toEqual(item);\n  });\n});\n```\n\n## Testing Async Operations\n\n### Using fakeAsync\n\n```typescript\nimport { fakeAsync, tick, flush } from '@angular\u002Fcore\u002Ftesting';\n\nit('should debounce search', fakeAsync(() => {\n  const fixture = TestBed.createComponent(SearchCmpt);\n  fixture.detectChanges();\n  \n  fixture.componentInstance.query.set('test');\n  \n  tick(300); \u002F\u002F Advance time for debounce\n  fixture.detectChanges();\n  \n  expect(fixture.componentInstance.results().length).toBeGreaterThan(0);\n  \n  flush(); \u002F\u002F Flush remaining timers\n}));\n```\n\n### Using waitForAsync\n\n```typescript\nimport { waitForAsync } from '@angular\u002Fcore\u002Ftesting';\n\nit('should load data', waitForAsync(() => {\n  const fixture = TestBed.createComponent(DataCmpt);\n  fixture.detectChanges();\n  \n  fixture.whenStable().then(() => {\n    fixture.detectChanges();\n    expect(fixture.componentInstance.data()).toBeDefined();\n  });\n}));\n```\n\n## Testing HTTP Resources\n\n```typescript\n@Component({\n  template: `\n    @if (userResource.isLoading()) {\n      \u003Cp>Loading...\u003C\u002Fp>\n    } @else if (userResource.hasValue()) {\n      \u003Cp>{{ userResource.value().name }}\u003C\u002Fp>\n    }\n  `,\n})\nexport class UserCmpt {\n  userId = signal('1');\n  userResource = httpResource\u003CUser>(() => `\u002Fapi\u002Fusers\u002F${this.userId()}`);\n}\n\ndescribe('UserCmpt', () => {\n  let httpMock: HttpTestingController;\n  \n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      imports: [UserCmpt],\n      providers: [\n        provideHttpClient(),\n        provideHttpClientTesting(),\n      ],\n    }).compileComponents();\n    \n    httpMock = TestBed.inject(HttpTestingController);\n  });\n  \n  it('should display user name after loading', () => {\n    const fixture = TestBed.createComponent(UserCmpt);\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('Loading');\n    \n    const req = httpMock.expectOne('\u002Fapi\u002Fusers\u002F1');\n    req.flush({ id: '1', name: 'John Doe' });\n    fixture.detectChanges();\n    \n    expect(fixture.nativeElement.textContent).toContain('John Doe');\n  });\n});\n```\n\nFor advanced testing patterns including component harnesses, router testing, form testing, and directive testing, see [references\u002Ftesting-patterns.md](references\u002Ftesting-patterns.md).\n\nFor Vitest migration from Jasmine, see [references\u002Fvitest-migration.md](references\u002Fvitest-migration.md).\n",{"name":5,"description":7},"master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fskills_sh\u002Fs\u002Fskills-sh_analogjs_angular-skills_angular-testing",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill angular-testing",{"tool":39,"command":40},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill angular-testing",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill angular-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fskills_sh\u002Fs\u002Fskills-sh_analogjs_angular-skills_angular-testing\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]