Skip to content

test: add Task and CompletableTask coverage#272

Open
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/test/task-completable-task-coverage
Open

test: add Task and CompletableTask coverage#272
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/test/task-completable-task-coverage

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #232

…e classes

Add comprehensive unit tests for the foundational Task<T> and
CompletableTask<T> classes which previously had zero direct test coverage.

Tests cover:
- Task: getResult() before completion, after failure, after success
- Task: getException() on non-failed and failed tasks
- Task: isComplete and isFailed state tracking
- CompletableTask: complete() with various result types (null, undefined)
- CompletableTask: fail() with and without explicit TaskFailureDetails
- CompletableTask: double-completion and cross-state error guards
- CompletableTask: parent notification via onChildCompleted()

Fixes #232

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds direct unit tests for the foundational Task<T> and CompletableTask<T> classes to ensure their base completion/failure semantics are covered independently of composite tasks and the orchestration executor, addressing the test gap described in #232.

Changes:

  • Adds isolated unit coverage for Task.getResult(), Task.getException(), isComplete, and isFailed.
  • Adds unit coverage for CompletableTask.complete() / fail() including double-completion/failure guards and parent notification behavior.
  • Introduces a small helper to construct TaskFailureDetails for failure-path assertions.


it("should notify parent via onChildCompleted when parent is set", () => {
const child = new CompletableTask<number>();
// Use WhenAllTask as the parent since CompositeTask is abstract
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.

[copilot-finds] Test: Task and CompletableTask base classes have zero direct unit tests

3 participants