800-angular-testing

800-angular-testing is a cursor rule for Cursor from JrPribs/SmarterStarter. It costs 4 tokens per session (2,865 once invoked), scanned A, original, MIT.

A set of rules for testing Angular components with Angular’s testing tools. Angular is a framework for web applications, and component tests check that individual interface parts behave correctly.

In plain words
What is it for?
Use it when writing tests with TestBed, testing standalone components, mocking services, and verifying component inputs and displayed content.
Why use it?
It provides a consistent setup for creating components, replacing services with test doubles, and checking rendered results and signal inputs.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { HeroService } from '../hero.service';.

Good fit Use it when writing tests with TestBed, testing standalone components, mocking services, and verifying component inputs and displayed content.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/JrPribs/SmarterStarter
agentmods
npx agentmods add rules/jrpribs/smarterstarter/800-angular-testing

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 800-angular-testing

README.md
[![agentmods](https://agentmods.dev/badge/rules/jrpribs/smarterstarter/800-angular-testing/github.svg)](https://agentmods.dev/rules/jrpribs/smarterstarter/800-angular-testing)
Your own site
<a href="https://agentmods.dev/rules/jrpribs/smarterstarter/800-angular-testing"><img src="https://agentmods.dev/badge/rules/jrpribs/smarterstarter/800-angular-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 800-angular-testing

Your own site · 80×15
<a href="https://agentmods.dev/rules/jrpribs/smarterstarter/800-angular-testing"><img src="https://agentmods.dev/badge/rules/jrpribs/smarterstarter/800-angular-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,865 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00004 $0.02865
Opus 5.5 $0.00002 $0.01146
Sonnet 5.5 $0.00001 $0.00573
Haiku 4.5 $0.00000 $0.00286

Measured 2mo ago against content hash 471f36b2d504, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

800-angular-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/800-angular-testing.mdc · 444 lines

How it starts

The opening of the file, as written. The whole thing — 444 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Angular Testing Best Practices

  • Component Testing Setup: Use TestBed to configure the test environment for components.
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { HeroDetailComponent } from './hero-detail.component';
import { HeroService } from '../hero.service';
import { of } from 'rxjs';

describe('HeroDetailComponent', () => {
  let component: HeroDetailComponent;
  let fixture: ComponentFixture<HeroDetailComponent>;
  let mockHeroService: jasmine.SpyObj<HeroService>;
  
  beforeEach(() => {
    mockHeroService = jasmine.createSpyObj(['getHero', 'updateHero']);
    
    TestBed.configureTestingModule({
      imports: [HeroDetailComponent], // For standalone component
      providers: [
        { provide: HeroService, useValue: mockHeroService }
      ]
    });
    
    fixture = TestBed.createComponent(HeroDetailComponent);
    component = fixture.componentInstance;
  });
  
  it('should create', () => {
    expect(component).toBeTruthy();
  });
  
  // More tests...
});
  • Testing Signal Inputs: Test signal inputs by directly setting them.
it('should display hero name', () => {
  // Arrange
  const testHero = { id: 1, name: 'SuperDude' };
  component.hero.set(testHero); // Set the signal input directly
  
  // Act
  fixture.detectChanges();
  
  // Assert
  const nameElement = fixture.debugElement.query(By.css('h2'));
  expect(nameElement.nativeElement.textContent).toContain('SUPERDUDE');
});
  • Testing Computed Values: Test computed values and their reactivity.
it('should compute full name correctly', () => {
  // Arrange
  component.firstName.set('John');
  component.lastName.set('Doe');
  
  // Assert
  expect(component.fullName()).toBe('John Doe');
  
  // Act - update a dependency
  component.firstName.set('Jane');
  
  // Assert - computed value should update
  expect(component.fullName()).toBe('Jane Doe');
});
  • Testing Effects: Test that effects perform the expected actions when signals change.
it('should load user data when userId changes', fakeAsync(() => {
  // Arrange
  const testUser = { id: '123', name: 'Test User' };
  mockUserService.getUser.and.returnValue(Promise.resolve(testUser));
  
  // Act - trigger the effect by setting userId
  component.userId.set('123');
  tick(); // Process the async operation
  
  // Assert
  expect(mockUserService.getUser).toHaveBeenCalledWith('123');
  expect(component.user()).toEqual(testUser);
}));
  • Testing Template Interaction: Test user interactions with the component.
it('should call save method when save button is clicked', () => {
  // Arrange
  spyOn(component, 'save');
  const testHero = { id: 1, name: 'SuperDude' };
  component.hero.set(testHero);
  fixture.detectChanges();
  
  // Act
  const saveButton = fixture.debugElement.query(By.css('button.save'));
  saveButton.triggerEventHandler('click', null);
  
  // Assert
  expect(component.save).toHaveBeenCalled();
});
  • Testing Outputs: Test that outputs emit the expected values.
it('should emit heroChange when save is called', () => {
  // Arrange
  const testHero = { id: 1, name: 'SuperDude' };
  component.hero.set(testHero);
  let emittedHero: Hero | undefined;
  component.heroChange.subscribe((hero: Hero) => emittedHero = hero);
  
  // Act
  component.save();
  
  // Assert
  expect(emittedHero).toEqual(testHero);
});
  • Testing Router Integration: Test components that interact with the router.
import { RouterTestingHarness } from '@angular/router/testing';

it('should load hero details based on route parameter', async () => {
  // Arrange
  const testHero = { id: 42, name: 'Test Hero' };
  mockHeroService.getHero.and.returnValue(of(testHero));
  
  // Create router testing harness
  const harness = await RouterTestingHarness.create();
  
  // Act - navigate to route with parameter
  await harness.navigateByUrl('/heroes/42');
  
  // Get the instantiated component
  const component = await harness.getComponentInstance<HeroDetailComponent>();
  
  // Assert
  expect(component.id()).toBe('42'); // Input binding should work
  expect(mockHeroService.getHero).toHaveBeenCalledWith(42);
  expect(component.hero()).toEqual(testHero);
});

Read the full file on GitHub · 444 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 444 lines · 4 tokens per session scan A 471f36b2d504

Subscribe to this mod's changes

800-angular-testing is a cursor rule published in the GitHub repository JrPribs/SmarterStarter (2 stars, last pushed 1y ago), licensed MIT. It adds 4 tokens to every session and 2,865 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.