You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/07/08 00:41:23 UTC

[I] add unit test coverage for replaceOneImmutable [texera]

aglinxinyuan opened a new issue, #6256:
URL: https://github.com/apache/texera/issues/6256

   ### Task Summary
   
   Add `array-utils.spec.ts` covering `replaceOneImmutable`, which returns a new array with the first predicate-matching element replaced and leaves the original untouched.
   
   ## Background
   
   `frontend/src/app/common/util/array-utils.ts` exports one generic immutable helper and has no test. Its immutability / no-op contract is exactly the kind of thing a regression can silently break.
   
   ```ts
   export function replaceOneImmutable<T>(
     arr: ReadonlyArray<T>,
     predicate: (t: T, idx: number) => boolean,
     item: T
   ): ReadonlyArray<T> {
     const idx = arr.findIndex(predicate);
     if (idx < 0) return arr;
     const next = arr.slice();
     (next as T[])[idx] = item;
     return next;
   }
   ```
   
   ## Behavior to pin
   
   | Scenario | Contract |
   | --- | --- |
   | predicate matches | replaces the element at the first matching index and returns a **new** array reference |
   | source untouched | the input array is not mutated |
   | no match | returns the **same** array reference (identity), unchanged |
   | predicate arg | receives the element index as its second argument |
   
   Follow `size-formatter.util.spec.ts` in `common/util/` as the style template (plain `describe`/`it`/`expect`, run with `ng test`).
   
   ## Scope
   
   - New spec: `frontend/src/app/common/util/array-utils.spec.ts`.
   - No production-code changes.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] add unit test coverage for replaceOneImmutable [texera]

Posted by "rbelavadi (via GitHub)" <gi...@apache.org>.
rbelavadi commented on issue #6256:
URL: https://github.com/apache/texera/issues/6256#issuecomment-4939646037

   /take


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] add unit test coverage for replaceOneImmutable [texera]

Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan closed issue #6256: add unit test coverage for replaceOneImmutable
URL: https://github.com/apache/texera/issues/6256


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] add unit test coverage for replaceOneImmutable [texera]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6256:
URL: https://github.com/apache/texera/issues/6256#issuecomment-4910333286

   <!-- texera:template-compliance -->
   👋 Thanks for opening this issue, @aglinxinyuan!
   
   It looks like the issue description doesn't quite follow our template yet:
   
   - This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
   
   Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
   
   You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org