Skip to content

test: migrate l to vitest assertions api#1752

Open
spliffone wants to merge 1 commit intomainfrom
test/use-vitest-assertions-l
Open

test: migrate l to vitest assertions api#1752
spliffone wants to merge 1 commit intomainfrom
test/use-vitest-assertions-l

Conversation

@spliffone
Copy link
Member

@spliffone spliffone commented Mar 25, 2026

@spliffone spliffone requested review from a team as code owners March 25, 2026 16:28
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors several Angular component test files to adopt the new signal-based input/output binding APIs and improve test assertions. The changes include migrating from ComponentRef.setInput() to inputBinding() and outputBinding() with signals, replacing vi.spyOn(component.instance.event, 'emit') with direct vi.fn() for outputs, and updating DOM assertions to use more semantic matchers like toHaveTextContent(), toHaveClass(), toBeDisabled(), and not.toBeInTheDocument(). A test case for handling an undefined link input in si-link.directive.spec.ts was removed during the refactoring and should be re-added to maintain test coverage.

@spliffone spliffone force-pushed the test/use-vitest-assertions-l branch from 0c55686 to 342d289 Compare March 25, 2026 16:49
let component: ComponentRef<TestComponent>;
let element: HTMLElement;

const heading = signal<TranslatableString>('Test heading');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const heading = signal<TranslatableString>('Test heading');
const heading: WritableSignal<string>;

and assignement in before each

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants