[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71BY7HF1FWMRXN8SDTHW5AK":3,"skill-same:01M71BY7HF1FWMRXN8SDTHW5AK":85},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":51,"commitSha":52,"skillDirectory":5,"forksCount":14,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M71BY7HF1FWMRXN8SDTHW5AK","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.","agency-black\u002FSkills","agency-black","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234862658?v=4","01M6HWVFPNGNR5N2CX9ECSAD57","agencia.black","01M719WF77BF3HN0N9FK1APEFY",0,"MIT","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-testing\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-testing\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"angular","angular testing","testing","vitest","integration tests","setting","infrastructure","patterns","cypress","typescript","write","change detection","signals","change","components","code","up","creation","testing patterns","unit","2026-11-10 10:12:30",false,"---\nname: angular-testing\ndescription: >-\n  Write unit and integration tests for Angular v20+ applications using Vitest or\n  Jasmine with TestBed and modern testing patterns. Use for testing components\n  with signals, OnPush change detection, services with inject(), and HTTP\n  interactions. Triggers on test creation, testing signal-based components,\n  mocking dependencies, or setting up test infrastructure. Don't use for E2E\n  testing with Cypress or Playwright, or for testing non-Angular\n  JavaScript\u002FTypeScript code.\nmetadata:\n  category: development\n  source:\n    repository: 'https:\u002F\u002Fgithub.com\u002Fanalogjs\u002Fangular-skills'\n    path: skills\u002Fangular-testing\n    license_path: LICENSE\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,"metadata":45,"description":7},{"source":46,"category":50},{"path":47,"repository":48,"license_path":49},"skills\u002Fangular-testing","https:\u002F\u002Fgithub.com\u002Fanalogjs\u002Fangular-skills","LICENSE","development","main","681496e0662f4c45c4758fae9d4510ae87311bf2","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills","https:\u002F\u002Fgithub.com\u002Fagency-black","http:\u002F\u002Fwww.dogma.black","Las grandes ideas merecen una ejecución impecable. Construimos plataformas web, aplicaciones y ecosistemas digitales completos. Esta Trinidad es nuestro dogma.","2026-05-29 16:13:55",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add agency-black\u002FSkills --skill angular-testing",{"tool":64,"command":65},"bunx","bunx skills add agency-black\u002FSkills --skill angular-testing",{"tool":67,"command":68},"pnpm","pnpm dlx skills add agency-black\u002FSkills --skill angular-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-testing\u002FSKILL.md",true,[72,75,81],{"path":49,"resourceType":49,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":16},"许可证",1072,{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Ftesting-patterns.md","REFERENCE","参考文档",17051,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-testing\u002Freferences\u002Ftesting-patterns.md",{"path":82,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fvitest-migration.md",3121,"https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fangular-testing\u002Freferences\u002Fvitest-migration.md",[86,95,121,146,169,192],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":90,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":94},"01M73SXDAGZVNRAJMDVXWEE26Q","x-article-publisher","Publish Markdown articles to X (Twitter) Articles editor with proper formatting. Use when user wants to publish a Markdown file\u002FURL to X Articles, or mentions \"publish to X\", \"post article to Twitter\", \"X article\", or wants help with X Premium article publishing. Handles cover image upload and converts Markdown to rich text automatically.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fqiaomu-x-article-publisher\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fqiaomu-x-article-publisher\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":40},"01M71JZVZ0TVW7Z5DQBRWSBG8A","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fzarr-python\u002FSKILL.md",[],[102,103,104,105,30,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120],"zarr","python","zarr python","scale","scientific computing","s3","numpy","use","s3fs","for","dask","parallel","edit","read","scientific","workflows","remote","Cloud Storage","arrays",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":40},"01M71JYXC5VAEJT8KXN5GRK32S","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fxvary-stock-research\u002FSKILL.md",[],[129,130,131,132,133,134,135,35,136,137,117,138,103,139,140,141,142,143,144,145],"xvary stock research","research","stock","xvary","market data","compare","Market","analyze","analysis","thesis","equity","community","sec edgar","with","2026","cursor","codex",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":150,"licenseFileUrl":151,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":40},"01M71JVSDPDQ5040YBN6J1ASKY","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[155,22,156,157,158,159,160,161,142,162,163,164,165,166,167,168,111],"webapp","webapp testing","screenshots","applications","behavior","web","playwright","browser","logs","toolkit","debugging","frontend","local","ui",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":150,"licenseFileUrl":173,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":40},"01M71JV64CW7R6FYYK9JWWGW0X","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[],[177,160,178,179,180,166,181,182,111,183,184,185,186,187,188,189,190,34,191,109],"web artifacts builder","artifacts","artifacts builder","builder","ui components","Tailwind","css","single-file","single","state management","routing","state","multi","react","file",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":198,"publishedAt":40},"01M71JS4X2FRY41DE84DEP06MN","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Fagency-black\u002FSkills\u002Fblob\u002Fmain\u002Fvercel-react-view-transitions\u002FSKILL.md",[],[199,190,200,201,202,203,34,204,205,206,207,208,209,210,211,212,183,213,214,215],"vercel react view transitions","transitions","vercel","react view transitions","view","libraries","create","route","api","when","implementing","element","states","types","Animation","back","shared"]