← All Angular Web Framework Flashcard Decks

Angular Quality & Compliance Flashcards

7 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 Angular Quality & Compliance flashcards as text
  1. Which Protractor (or Cypress) concept is equivalent to Angular's `waitForAngular` that ensures the app is stable before assertions?

    Answer: Angular zone stability check

    Tools aware of Angular's Zone.js wait for the zone to become stable (no pending microtasks or timers) before proceeding, ensuring the app is fully rendered.

  2. What does enabling `strictNullChecks` in `tsconfig.json` enforce in an Angular application?

    Answer: Variables cannot hold null or undefined unless explicitly typed to allow it

    With `strictNullChecks`, TypeScript requires developers to explicitly handle `null` and `undefined` in type declarations, preventing null reference errors at runtime.

  3. When should you use `spyOn(service, 'method').and.returnValue(of(data))` in an Angular test?

    Answer: When mocking an Observable-returning service method to control test data

    Spying on a method and returning a controlled Observable with `of(data)` lets you isolate the component under test from real service logic and async behavior.

  4. What is a 'shallow' component test in Angular?

    Answer: A test that renders the component without fully rendering its child components

    Shallow testing renders only the component under test while stubbing or ignoring child components, reducing test complexity and coupling.

  5. What Angular feature helps enforce that private API surfaces are not accidentally exported in a library?

    Answer: The `public_api.ts` barrel file combined with `ng-packagr`

    `ng-packagr` uses `public_api.ts` as the entry point, so only symbols explicitly exported there become part of the library's public API.

  6. Which Angular schematic command adds ESLint support to an existing project?

    Answer: ng add @angular-eslint/schematics

    Running `ng add @angular-eslint/schematics` installs and configures ESLint with Angular-specific rules, replacing or supplementing the existing lint setup.

  7. What is the main benefit of using `ChangeDetectionStrategy.OnPush` from a testability perspective?

    Answer: Component state changes are predictable—triggered only by input changes or explicit markForCheck()

    With `OnPush`, you control exactly when change detection runs, making it easier to write deterministic tests that verify specific state transitions.