(
current: { description?: string | null },
input: UpdateTaskInput
)
| 148 | if (!needsBodySplit(rawTitle, compactTitle)) { |
| 149 | return { |
| 150 | title: normalizeTaskTitle(rawTitle), |
| 151 | description: input.description, |
| 152 | priority: input.priority, |
| 153 | }; |
| 154 | } |
| 155 | |
| 156 | return { |
| 157 | title: deriveTitleFromBody(rawTitle), |
| 158 | description: mergeDescriptionParts([rawTitle, input.description]), |
| 159 | priority: input.priority, |
| 160 | }; |
| 161 | } |
| 162 | |
| 163 | function normalizeUpdateTaskInput( |
| 164 | current: { description?: string | null }, |
| 165 | input: UpdateTaskInput |
| 166 | ): UpdateTaskInput { |
| 167 | if (input.title === undefined) { |
| 168 | return input; |
| 169 | } |
| 170 | |
| 171 | const rawTitle = input.title; |
| 172 | const compactTitle = compactWhitespace(rawTitle); |
| 173 | if (compactTitle.length === 0) { |
| 174 | throw new ValidationError('Task title is required'); |
| 175 | } |
| 176 | |
| 177 | if (!needsBodySplit(rawTitle, compactTitle)) { |
| 178 | return { |
| 179 | ...input, |
| 180 | title: normalizeTaskTitle(rawTitle), |
| 181 | }; |
| 182 | } |
| 183 |
no test coverage detected