Skip to content

test: migrate m to vitest assertions api#1753

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

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

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:33
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 test files to align with modern Angular testing practices, specifically by adopting signal-based input handling and using more specific testing library matchers like toHaveTextContent, toBeInTheDocument, and toHaveClass. It also removes unused Angular imports and injections. A review comment suggests improving type safety in si-markdown-renderer.component.spec.ts by explicitly typing the text input to handle null values, or by typing the signal as WritableSignal<string | null> to avoid unnecessary casts.

fixture.componentRef.setInput('text', null);
fixture.detectChanges();
it('should render empty content for null/undefined input', async () => {
text.set(null as unknown as string);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The use of null as unknown as string suggests that the text input of SiMarkdownRendererComponent might be strictly typed as string, while this test attempts to pass null. If the component is intended to gracefully handle null or undefined values for its text input, consider updating the input's type definition in SiMarkdownRendererComponent to Input<string | null | undefined> to improve type safety and remove the need for this cast. If null is considered an invalid state, this test is valid, but the cast could be avoided if the signal text was typed as WritableSignal<string | null>.

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.

1 participant