import { Type } from '@angular/core'; /** * `toHaveDirectiveApplied` — the one fact a directive spec is about, and the one Angular reports * three different wrong ways. * * When a directive is not in the host's scope, what surfaces is: `NG0303: Can't bind to 'appTruncate' * since it isn't a known property of 'div'` (which sends the reader to the `@NgModule` where the * directive *is* declared, correctly); `NG0304: 'x' is not a known element` (an absent **directive** * reported as an absent **component**); or — for a directive used as a bare attribute, with no * binding — nothing at all, and a green test asserting on a directive that never ran. * * The matcher asserts the fact directly, and its failure names the two things that actually cause * it in a bundled test build. */ declare global { namespace Chai { interface Assertion { /** Assert that `directive` is applied somewhere in this fixture (optionally, on `selector`). */ toHaveDirectiveApplied(directive: Type, selector?: string): void; } } } /** * Register {@link Matchers.toHaveDirectiveApplied}. Call once, from your setup file. * * ```ts * registerDirectiveMatchers(); * * expect(fixture).toHaveDirectiveApplied(TruncateDirective, 'div'); * ``` */ declare function registerDirectiveMatchers(): void; /** The slice of a resource these matchers read. `error` is absent on some hand-built doubles. */ interface ResourceLike { status(): string; value(): TValue; error?(): Error | undefined; } declare global { namespace Chai { interface Assertion { /** The resource is still in flight — `status()` is `'loading'` or `'reloading'`. */ toBeLoading(): void; /** The resource has resolved *and* its value deep-equals the expected one. */ toHaveResourceValue(expected: unknown): void; /** The resource has failed; with an argument, its error message matches too. */ toHaveResourceError(expected?: RegExp | string): void; } } } /** * Register the resource matchers with the runner. Call once, from your setup file. * * @example * ```ts * registerResourceMatchers(); // once, in the setup file * * expect(component.products).toBeLoading(); * * httpTesting.expectOne('/api/products').flush([product]); * await settleResource(component.products); * * expect(component.products).toHaveResourceValue([product]); * ``` * * `toHaveResourceValue` deliberately fails a resource that is still loading even when its default * value happens to match, because that is the assertion this whole family exists to stop passing. */ declare function registerResourceMatchers(): void; /** Anything readable like a signal: `signal()`, `computed()`, `input()`, or a plain getter. */ type SignalLike = () => T; declare global { namespace Chai { interface Assertion { /** Read the signal under test and deep-compare its current value. */ toHaveSignalValue(expected: unknown): void; } } } /** * Register {@link toHaveSignalValue} with the runner. Call once, from your setup file. * * @example * ```ts * registerSignalMatchers(); // once, in the setup file * * expect(component.total).toHaveSignalValue(3); * ``` */ declare function registerSignalMatchers(): void; export { type ResourceLike, type SignalLike, registerDirectiveMatchers, registerResourceMatchers, registerSignalMatchers };