You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Ma77Ball (via GitHub)" <gi...@apache.org> on 2026/06/07 12:31:29 UTC
[I] Add unit tests for RegistrationRequestModalComponent [texera]
Ma77Ball opened a new issue, #5467:
URL: https://github.com/apache/texera/issues/5467
### Task Summary
`RegistrationRequestModalComponent`
(`frontend/src/app/common/service/user/registration-request-modal/registration-request-modal.component.ts`)
has no `*.spec.ts` file. It is a small form modal with no service dependencies. It seeds
`name` and `email` from the injected `NZ_MODAL_DATA`, and `getValues()` returns the
trimmed `affiliation` and `reason`. Both are easy to test directly.
### What to do (step by step)
1. Create the spec file next to the component, with the Apache license header.
2. Provide `NZ_MODAL_DATA` with `{ uid, email, name }`.
3. Assert constructor seeding and `getValues()` trimming behavior.
4. Run `yarn test -- registration-request-modal`, then `yarn lint`.
### Cover
- `should create`.
- Constructor copies `data.name` into `name` and `data.email` into `email`.
- Constructor handles a null/empty `data` gracefully (`name`/`email` become `""`).
(You can test this by providing `NZ_MODAL_DATA` as `null`.)
- `getValues()` trims whitespace: set `component.affiliation = " UCI "` and
`component.reason = " hi "`, expect `{ affiliation: "UCI", reason: "hi" }`.
### Starter skeleton
```ts
// <Apache license header>
import { TestBed } from "@angular/core/testing";
import { NZ_MODAL_DATA } from "ng-zorro-antd/modal";
import { RegistrationRequestModalComponent } from "./registration-request-modal.component";
function setup(data: any) {
TestBed.configureTestingModule({
imports: [RegistrationRequestModalComponent],
providers: [{ provide: NZ_MODAL_DATA, useValue: data }],
});
const fixture = TestBed.createComponent(RegistrationRequestModalComponent);
return fixture.componentInstance;
}
describe("RegistrationRequestModalComponent", () => {
it("seeds name and email from modal data", () => {
const c = setup({ uid: 1, email: "a@b.c", name: "Ada" });
expect(c.name).toBe("Ada");
expect(c.email).toBe("a@b.c");
});
it("trims affiliation and reason in getValues()", () => {
const c = setup({ uid: 1, email: "", name: "" });
c.affiliation = " UCI ";
c.reason = " hi ";
expect(c.getValues()).toEqual({ affiliation: "UCI", reason: "hi" });
});
});
```
### 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 tests for RegistrationRequestModalComponent [texera]
Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on issue #5467:
URL: https://github.com/apache/texera/issues/5467#issuecomment-4642701664
reserved for first-time contributor
--
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 tests for RegistrationRequestModalComponent [texera]
Posted by "EmilySun621 (via GitHub)" <gi...@apache.org>.
EmilySun621 commented on issue #5467:
URL: https://github.com/apache/texera/issues/5467#issuecomment-4685965625
/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 tests for RegistrationRequestModalComponent [texera]
Posted by "Roshan3580 (via GitHub)" <gi...@apache.org>.
Roshan3580 commented on issue #5467:
URL: https://github.com/apache/texera/issues/5467#issuecomment-4664578602
/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