apache / apache/texera

add unit test coverage for PanelService

Open Beginner friendly
#6,262 3 comments 0 reactions 0 assignees View on GitHub
starter-task
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Task Summary

Add `panel.service.spec.ts` covering `PanelService`, a tiny event bus that exposes two `Subject` streams (`closePanelStream`, `resetPanelStream`) with `closePanels()` / `resetPanels()` triggers.

## Background

`frontend/src/app/workspace/service/panel/panel.service.ts` is a dependency-free service (instantiable directly via `new PanelService()`), so no `TestBed` wiring is required.

```ts
get resetPanelStream() { return this.resetPanelSubject.asObservable(); }
resetPanels() { this.resetPanelSubject.next(); }
get closePanelStream() { return this.closePanelSubject.asObservable(); }
closePanels() { this.closePanelSubject.next(); }
```

## Behavior to pin

| Scenario | Contract |
| --- | --- |
| subscribe `resetPanelStream`, call `resetPanels()` | subscriber fires exactly once |
| subscribe `closePanelStream`, call `closePanels()` | subscriber fires exactly once |
| stream independence | calling `resetPanels()` does not emit on `closePanelStream`, and vice-versa |

Subscribe to the stream, invoke the trigger, and assert the emission count (e.g. increment a counter in the subscription). Follow `size-formatter.util.spec.ts` for the plain `describe`/`it`/`expect` style (`ng test`).

## Scope

- New spec: `frontend/src/app/workspace/service/panel/panel.service.spec.ts`.
- No production-code changes.

### Task Type

- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other

Contributor guide

Open the contributing guide

Research direction

Read frontend/src/app/workspace/service/panel/panel.service.ts and follow the plain describe/it/expect style in size-formatter.util.spec.ts. Add frontend/src/app/workspace/service/panel/panel.service.spec.ts, then run ng test. Done means resetPanels() and closePanels() each emit once on their own stream and never emit on the other stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing
Issue type
Refactor
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.