Skip to content

test(API): Add tests for UpdateProjectDto (no-changelog) #16452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dariacodes
Copy link
Contributor

@dariacodes dariacodes commented Jun 17, 2025

Summary

This PR adds tests for UpdateProjectDto.

It also reverts a line introduced in Project Descriptions PR, which incorrectly assumed that the icon field is a string. While this doesn't currently break the app (since we always send all fields when updating a project, making the condition always evaluate to true), it's still misleading and technically incorrect.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/ADO-3670/tech-debt-add-tests-for-update-project-dto

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@dariacodes dariacodes changed the title test(api): Add tests for UpdateProjectDto (no-changelog) test(API): Add tests for UpdateProjectDto (no-changelog) Jun 17, 2025
@dariacodes dariacodes marked this pull request as ready for review June 17, 2025 16:05
@dariacodes dariacodes requested a review from CharlieKolb June 17, 2025 16:06
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/controllers/project.controller.ts 0.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 1 issue across 2 files. Review it in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

@@ -204,7 +204,7 @@ export class ProjectController {
@Param('projectId') projectId: string,
) {
const { name, icon, relations, description } = payload;
if ([name, icon, description].some((data) => typeof data === 'string')) {
if (name || icon || description) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using truthiness to decide whether to trigger the project update skips valid updates where description is an empty string (""), because "" is falsy. Check for undefined instead so legitimate empty values are accepted.

Suggested change
if (name || icon || description) {
if (name !== undefined || icon !== undefined || description !== undefined) {

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant