-
Notifications
You must be signed in to change notification settings - Fork 64
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
LabelService: create custom operator for label synchronisation #590
LabelService: create custom operator for label synchronisation #590
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the comments I've left, it looks good to me!
|
||
describe('RepositoryService', () => { | ||
beforeEach(() => { | ||
labelService = jasmine.createSpyObj('GithubService', ['synchronizeRemoteLabels']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I just check why is it 'GithubService' for the spy object? Shouldn't it be 'labelService' instead? Let me know if my interpretation is correct😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes i made a typo! Thanks for pointing that out!!
Codecov Report
@@ Coverage Diff @@
## master #590 +/- ##
==========================================
+ Coverage 65.14% 65.65% +0.50%
==========================================
Files 67 67
Lines 2106 2111 +5
Branches 199 198 -1
==========================================
+ Hits 1372 1386 +14
+ Misses 696 686 -10
- Partials 38 39 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Just one question regarding the test case
describe('.syncLabels()', () => { | ||
it('should throw an error given an Observable of false', () => { | ||
of(false) | ||
.pipe(repositoryService.syncLabels()) | ||
.subscribe({ | ||
error: (err) => | ||
expect(err).toEqual(new Error(SESSION_AVALIABILITY_FIX_FAILED)), | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick question cause I'm not entirely sure,
if we supply an of(true)
does this test fail? Or do we need to supply the next:
in the .subscribe()
?
So like this? Just checking cause I'm not sure haha
it('should throw an error given an Observable of false', () => {
of(false)
.pipe(repositoryService.syncLabels())
.subscribe({
next: () => fail(),
error: (err) => expect(err).toEqual(new Error(SESSION_AVALIABILITY_FIX_FAILED)),
});
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, actually I just realised with the above, it would also pass the TC if i supply a value of true 😅
We would need to supply the next
to ensure that it fails!
Thanks for noticing! ><
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries haha actually I realized we've made this mistake in other areas also 😆 I'll make an issue to clean that up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright! 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seanlowjk for working on this.
I have a different opinion that the label synchronisation custom operator should reside in LabelService
, and not the newly created RepositoryService
.
It seems neater to keep label-related responsibilities under LabelService
.
The RepositoryService
can be in charge of checking whether a repo exists, asking the user for permission to create a repo, and creating the repo (using GithubService
under-the-hood as you mentioned).
We can rename RepositoryService
--> RepoCreatorService
(other naming suggestions welcome)
What do you all think?
Yea since it is mainly responsible for the creating of the repository due to the steps mentioned earlier, it would be better to use the name of I will shift |
Updated the title of the PR and the description to better suit the purpose of this PR! |
@seanlowjk I've edited your PR title to make it easier to understand. Let's try to use the |
@anubh-v have made the following changes! I have tested the following ! 1, Tests that 15 labels to be created when Abstracted the asseting of label creation via Hope this helps in testing of the cases as mentioned earlier! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 , just one nit
@seanlowjk thanks for the work. Can you write up the commit message for this PR? |
@anubh-v I have key-ed in the suggested commit message to capture the idea of this PR! Hope this commit message is better with regards to capturing the purpose and how we can solve the issue mentioned! |
Summary
This PR addresses part of #549 , which abstracts the steps of
sessionSetup()
inPhaseService
to readable, custom operatorsDescription
This PR does the following:
syncLabels()
method inLabelService
sessionSetup()
inPhaseService
syncLabels()
andcheckSessionCreation()
Suggested Commit Message: