Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor test cases for Login Component, Session Model and Conflict Model #241

Merged
merged 7 commits into from
Feb 8, 2024

Conversation

NereusWB922
Copy link
Contributor

Summary:

Fixes part of #85

Type of change:

  • 🧪 Tests Update

Changes Made:

  • Refactor test cases for Login Component
  • Remove test cases for Conflict model (removed model)
  • Refactor test cases for Session model

Proposed Commit Message:

Refactor test cases

The test cases for the Login Component and Session Model are outdated. 

Additionally, the Conflict Model has been removed. 

Let's refactor the test cases for the Login Component and Session Model 
and remove the test cases for the Conflict Model.

Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Just a few minor changes to make things clearer.

tests/app/core/models/session-model.spec.ts Outdated Show resolved Hide resolved
tests/app/auth/login/login.component.spec.ts Outdated Show resolved Hide resolved
tests/app/auth/login/login.component.spec.ts Outdated Show resolved Hide resolved
tests/app/core/models/session-model.spec.ts Outdated Show resolved Hide resolved
angular.json Outdated Show resolved Hide resolved
@luminousleek
Copy link
Contributor

Actually this PR could have been broken down further into 2 PRs: one for the Login component and one for the Session model. In fact I'll probably encourage you to break down the second part of your test refactoring PR to 4 separate PRs: one for each spec you're refactoring - makes our job as reviewers easier (since we can review 1 spec at a time without having to review all 4) and also means that reviews will be faster.

@NereusWB922
Copy link
Contributor Author

Actually this PR could have been broken down further into 2 PRs: one for the Login component and one for the Session model. In fact I'll probably encourage you to break down the second part of your test refactoring PR to 4 separate PRs: one for each spec you're refactoring - makes our job as reviewers easier (since we can review 1 spec at a time without having to review all 4) and also means that reviews will be faster.

ok got it. I will break down the second part later. Thanks for the review, will do the changes soon.

@NereusWB922 NereusWB922 force-pushed the 85-refactor-tests-part-1 branch from 6a1c4d4 to 0aefb61 Compare February 7, 2024 07:08
Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes! Still a few that you might have missed out.

expect(component.startLoginProcess).toHaveBeenCalledWith(false);
});

it('should call startLoginProcess with true in startIncludePrivateLoginProcess', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as the one I made in line 39 above.

.pipe(assertSessionDataIntegrity())
.subscribe({
next: () => fail(),
error: (err) => expect(err).toEqual(new Error(OPENED_PHASE_REPO_UNDEFINED))
});
of({ ...BUG_REPORTING_PHASE_SESSION_DATA, phaseBugReporting: null })
of({ ...VALID_SESSION_DATA, sessionRepo: [{ phase: Phase.issuesViewer, repo: null }] })
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as the one I made for line 54 above, also applies to lines 66 and 72.

export const MULTIPLE_OPEN_PHASES_SESSION_DATA: SessionData = {
...BUG_REPORTING_PHASE_SESSION_DATA,
openPhases: [Phase.phaseBugReporting, Phase.phaseTeamResponse, Phase.phaseTesterResponse, Phase.phaseModeration]
export const SESSION_DATA_WITH_INVALID_PHASE: SessionData = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this constant being used in any of the tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, will remove the constant.

@NereusWB922 NereusWB922 force-pushed the 85-refactor-tests-part-1 branch from 0aefb61 to 71a1b5c Compare February 7, 2024 10:05
@NereusWB922 NereusWB922 force-pushed the 85-refactor-tests-part-1 branch from 3d344a7 to 02037c5 Compare February 7, 2024 10:25
Copy link
Contributor

@luminousleek luminousleek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@NereusWB922 NereusWB922 changed the title Refactor test cases - part 1 Refactor test cases for Login Component, Session Model and Conflict Model Feb 8, 2024
@NereusWB922 NereusWB922 merged commit a6efcb9 into CATcher-org:main Feb 8, 2024
3 checks passed
@NereusWB922 NereusWB922 deleted the 85-refactor-tests-part-1 branch February 8, 2024 08:42
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.

2 participants